Last active
April 9, 2018 18:49
-
-
Save admix/072a2c42972f6c35c18f40ccca5110ab to your computer and use it in GitHub Desktop.
Remove email from chain_notifications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from archetypes import entities | |
| from archetypes.services import sqlservice | |
| def remove_from_chain_notifications(email): | |
| with sqlservice() as db: | |
| notif = db.fetch_one(entities.Fact, key='chain_notifications') | |
| for n in notif.value['email_details']: | |
| print n['email_types'] | |
| for t in n['to']: | |
| if t == email: | |
| print "Removing: {}".format(t) | |
| n['to'].remove(t) | |
| with sqlservice() as db: | |
| notif2 = db.save_fact(notif) | |
| remove_from_chain_notifications('[email protected]') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment