| File | Date | Author | Commit |
|---|---|---|---|
| .gitignore | 2015-12-30 |
|
[16ba17] ignore .pyc |
| README.md | 2012-10-16 |
|
[2731a3] don't del+add a split email change |
| requirements.txt | 2014-11-13 |
|
[b4cc23] Add MySQL-python to requirements |
| update.py | 2016-02-21 |
|
[912642] Add flag to track visibility in directory |
| update.sh | 2012-08-04 |
|
[9d90db] provide a warning if database files haven't bee... |
This script is composed of 2 parts: updating a mysql database and updating iContact via its APIs. The script reads from a Logos (Church Management Software) database: member.dbf and family.dbf files. It filters for certain members based on the database fields.
Like most python scripts, it is best to run within a python virtual environment to keep packages separate. Run:
virtualenv venvsource venv/bin/activatepip install -r requirements.txtconfig.json file.For example:
{
"db_url": "mysql://username:password@dbhost/mydatabase",
"db_debug": true,
"icontact_api_key": "BLAH",
"icontact_username": "BLER",
"icontact_password": "BLUZ",
"icontact_use_sandbox": true,
"main_list_name": "Congregation List",
"email_to": "me@gmail.com",
"mail_host": "localhost"
}
Run: python update.py --skip-icontact
This will create a cos_members table in your database and populate it. Separate records will be created for shared email addresses (e.g. husband and wife with one family email address.)
First, ensure that iContact has custom fields called logos_member_id and parish. Those are used for synchronizing the data. Run:
python update.py --skip-db
This will create new iContact records in the "main list" (as defined by the config.json). Records with a logos_member_id or matching email address will be updated. Others will be left untouched. Records will be deleted if they have a logos_member_id value but no longer are considered 'active'.
Shared email addresses (e.g. husband and wife with one family email address) will be combined into a single record, using both of their names. Updates to this record will be handled just like an individual update. If a email address sharing changes (e.g. starts sharing or stops sharing), the prior iContact record(s) will be updated and new record(s) created.
If a change occurs on the iContact side (e.g. a person updates their own email address), an email will be sent to email_to letting them know they should update the Logos database.
There are a few tests contained within update.py. Run pip install nose once, and then nosetests update.py to run the tests.