Make python-postmonkey not a required package.

This is in some ways a regression, but because we don't have
python-postmonkey packaged right now, this is required to make the
Zulip production installation process work on Trusty.

(imported from commit 539d253eb7fedc20bf02cc1f0674e9345beebf48)
This commit is contained in:
Tim Abbott
2015-09-24 23:19:47 -07:00
parent a0006d5faf
commit ae4cb6df35
3 changed files with 5 additions and 5 deletions

View File

@@ -48,7 +48,6 @@ class zulip::app_frontend {
# Needed for S3 file uploads # Needed for S3 file uploads
"python-boto", "python-boto",
# Needed to send email # Needed to send email
"python-postmonkey",
"python-mandrill", "python-mandrill",
# Needed to generate diffs for edits # Needed to generate diffs for edits
"python-diff-match-patch", "python-diff-match-patch",

View File

@@ -3,7 +3,6 @@ from __future__ import absolute_import
from django.conf import settings from django.conf import settings
from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.wsgi import WSGIRequest
from django.core.handlers.base import BaseHandler from django.core.handlers.base import BaseHandler
from postmonkey import PostMonkey, MailChimpException
from zerver.models import get_user_profile_by_email, \ from zerver.models import get_user_profile_by_email, \
get_user_profile_by_id, get_prereg_user_by_email, get_client get_user_profile_by_id, get_prereg_user_by_email, get_client
from zerver.lib.context_managers import lockfile from zerver.lib.context_managers import lockfile
@@ -83,18 +82,21 @@ class QueueProcessingWorker(object):
def stop(self): def stop(self):
self.q.stop_consuming() self.q.stop_consuming()
if settings.MAILCHIMP_API_KEY:
from postmonkey import PostMonkey, MailChimpException
@assign_queue('signups') @assign_queue('signups')
class SignupWorker(QueueProcessingWorker): class SignupWorker(QueueProcessingWorker):
def __init__(self): def __init__(self):
super(SignupWorker, self).__init__() super(SignupWorker, self).__init__()
if settings.MAILCHIMP_API_KEY != '': if settings.MAILCHIMP_API_KEY:
self.pm = PostMonkey(settings.MAILCHIMP_API_KEY, timeout=10) self.pm = PostMonkey(settings.MAILCHIMP_API_KEY, timeout=10)
def consume(self, data): def consume(self, data):
merge_vars=data['merge_vars'] merge_vars=data['merge_vars']
# This should clear out any invitation reminder emails # This should clear out any invitation reminder emails
clear_followup_emails_queue(data["EMAIL"]) clear_followup_emails_queue(data["EMAIL"])
if settings.MAILCHIMP_API_KEY != '' and settings.PRODUCTION: if settings.MAILCHIMP_API_KEY and settings.PRODUCTION:
try: try:
self.pm.listSubscribe( self.pm.listSubscribe(
id=settings.ZULIP_FRIENDS_LIST_ID, id=settings.ZULIP_FRIENDS_LIST_ID,

View File

@@ -119,7 +119,6 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '',
'S3_SECRET_KEY': '', 'S3_SECRET_KEY': '',
'S3_BUCKET': '', 'S3_BUCKET': '',
'S3_AVATAR_BUCKET': '', 'S3_AVATAR_BUCKET': '',
'MAILCHIMP_API_KEY': '',
'LOCAL_UPLOADS_DIR': None, 'LOCAL_UPLOADS_DIR': None,
'DROPBOX_APP_KEY': '', 'DROPBOX_APP_KEY': '',
'ERROR_REPORTING': True, 'ERROR_REPORTING': True,