Skip to content

Instantly share code, notes, and snippets.

@admix
Last active April 9, 2018 18:49
Show Gist options
  • Save admix/072a2c42972f6c35c18f40ccca5110ab to your computer and use it in GitHub Desktop.
Save admix/072a2c42972f6c35c18f40ccca5110ab to your computer and use it in GitHub Desktop.
Remove email from chain_notifications
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