From ae4cb6df35c0ba49304f4da3fe40e2100bef8e1c Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 24 Sep 2015 23:19:47 -0700 Subject: [PATCH] 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) --- puppet/zulip/manifests/app_frontend.pp | 1 - zerver/worker/queue_processors.py | 8 +++++--- zproject/settings.py | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/puppet/zulip/manifests/app_frontend.pp b/puppet/zulip/manifests/app_frontend.pp index da932c8b8e..3eac9b6831 100644 --- a/puppet/zulip/manifests/app_frontend.pp +++ b/puppet/zulip/manifests/app_frontend.pp @@ -48,7 +48,6 @@ class zulip::app_frontend { # Needed for S3 file uploads "python-boto", # Needed to send email - "python-postmonkey", "python-mandrill", # Needed to generate diffs for edits "python-diff-match-patch", diff --git a/zerver/worker/queue_processors.py b/zerver/worker/queue_processors.py index c123e49266..d8bfb5a3ab 100644 --- a/zerver/worker/queue_processors.py +++ b/zerver/worker/queue_processors.py @@ -3,7 +3,6 @@ from __future__ import absolute_import from django.conf import settings from django.core.handlers.wsgi import WSGIRequest from django.core.handlers.base import BaseHandler -from postmonkey import PostMonkey, MailChimpException from zerver.models import get_user_profile_by_email, \ get_user_profile_by_id, get_prereg_user_by_email, get_client from zerver.lib.context_managers import lockfile @@ -83,18 +82,21 @@ class QueueProcessingWorker(object): def stop(self): self.q.stop_consuming() +if settings.MAILCHIMP_API_KEY: + from postmonkey import PostMonkey, MailChimpException + @assign_queue('signups') class SignupWorker(QueueProcessingWorker): def __init__(self): super(SignupWorker, self).__init__() - if settings.MAILCHIMP_API_KEY != '': + if settings.MAILCHIMP_API_KEY: self.pm = PostMonkey(settings.MAILCHIMP_API_KEY, timeout=10) def consume(self, data): merge_vars=data['merge_vars'] # This should clear out any invitation reminder emails clear_followup_emails_queue(data["EMAIL"]) - if settings.MAILCHIMP_API_KEY != '' and settings.PRODUCTION: + if settings.MAILCHIMP_API_KEY and settings.PRODUCTION: try: self.pm.listSubscribe( id=settings.ZULIP_FRIENDS_LIST_ID, diff --git a/zproject/settings.py b/zproject/settings.py index db75719e07..463d9ebaa3 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -119,7 +119,6 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '', 'S3_SECRET_KEY': '', 'S3_BUCKET': '', 'S3_AVATAR_BUCKET': '', - 'MAILCHIMP_API_KEY': '', 'LOCAL_UPLOADS_DIR': None, 'DROPBOX_APP_KEY': '', 'ERROR_REPORTING': True,