Files
zulip/zephyr/management/commands/process_signups.py
Tim Abbott 23beabb80c [manual] Rename manage.py subscribe_new_users to process_signups.
The old name was very confusing, and this fits the convention of "the
processor for the signups" queue a la "process_user_activity".

This requires doing a

supervisorctl stop humbug-workers:humbug-events-subscribe-new-users
puppet apply

to deploy the supervisord configuration changes and properly restart
the signups queue.

(imported from commit 0ee2dad837142afa64025446e22956709771a192)
2013-07-17 17:50:19 -04:00

24 lines
760 B
Python

from __future__ import absolute_import
from postmonkey import PostMonkey
from django.core.management.base import BaseCommand
from django.conf import settings
from zephyr.lib.queue import SimpleQueueClient
class Command(BaseCommand):
pm = PostMonkey(settings.MAILCHIMP_API_KEY, timeout=10)
def subscribe(self, ch, method, properties, data):
self.pm.listSubscribe(
id=settings.HUMBUG_FRIENDS_LIST_ID,
email_address=data['EMAIL'],
merge_vars=data['merge_vars'],
double_optin=False,
send_welcome=False)
def handle(self, *args, **options):
q = SimpleQueueClient()
q.register_json_consumer("signups", self.subscribe)
q.start_consuming()