Wiki source for PypvsEmailQueue


Show raw source

======pypvs E-mail Queue======

The pypvs mail queue handles outgoing E-mails generated by pypvs. These include, but are not limited to, tracked data update notifications, API subscription notifications, and upcoming election notifications. There are many scripts involved, but the one that handles the final sending of the E-mail is ``scripts/process_notify_queue.py`` and runs as a daemon.

=====Components=====

1) misc/management/commands/electnotify.py - generates message objects for upcoming elections notifications
1) misc/management/commands/rosternotify.py - **defunct for performance reasons** - generates message objects about each user's "roster" changes. A roster being any candidates or officials associated to their zip+5
1) misc/management/commands/subscriptions.py - generates message objects for things like resubscriptions and expirations
1) misc/management/commands/trackedupdates.py - Figures out what tracked items have been changes
1) misc/management/commands/tracknotify.py - generates message objects for each user according to what trackedupdates found
1) scripts/process_notify_queue.py - Processes message objects from the redis hotqueue and sends E-mails

=====Testing The Mail Queue=====

A simple way to test of process_notify_queue.py is working.

%%(python)
>>> import django
>>> django.setup()
>>> from django.conf import settings
>>> from hotqueue import HotQueue
>>> from tracking.models import GenericNotifyMessage
>>> m = GenericNotifyMessage()
>>> m.user_id = 175
>>> m.email = 'mike@votesmart.org'
>>> m.subject = 'hey bro'
>>> m.message = 'Just testing out the system. \n\n How is it working?'
>>> queue = HotQueue("usernotify", host=settings.REDIS_HOST)
>>> queue.put(m)
>>>
%%

----
CategoryPypvs
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki