Skip to content

Instantly share code, notes, and snippets.

@conniec
Created June 28, 2012 21:32
Show Gist options
  • Save conniec/3014061 to your computer and use it in GitHub Desktop.
Save conniec/3014061 to your computer and use it in GitHub Desktop.
fisher email notifications
from lfcore.ident.api import IdentAPI
import time
d = Domain.objects.get(name="rooms.fisher-0.fyre.co")
#d = Domain.objects.get(pk=5)
#all_users = UserProfile.objects.filter(domain=d)[:20]
all_users = UserProfile.objects.filter(domain=d, state=RowState.enums().ENABLED)
site = Site.objects.filter(domain=d)[0]
data = {
"autofollow_conversations": 'false',
"email_notifications": {
"comments": "never",
"moderator_comments": "never",
"moderator_flags": "never",
"replies": "never",
"likes": "never",
},
}
for (counter, user) in enumerate(all_users):
if counter % 20 == 0:
time.sleep(0.07)
IdentAPI.update_remote_profile(user, data)
# user.set_email_policy('comments', 'never')
# user.set_email_policy('comments', 'never')
# user.set_email_policy('moderator_comments', 'never')
# user.set_email_policy('moderator_flags', 'never')
# user.set_email_policy('replies', 'never')
# user.set_email_policy('likes', 'never')
# user.set_auto_follow = False
# user.save()
print user.find_email_policy_section(site=site)
print user.auto_follow
d.email_notifications_enabled = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment