From 6ae8b541f957b49ae86051814097e769d20f29af Mon Sep 17 00:00:00 2001 From: Deb Date: Tue, 12 Jul 2011 21:21:35 -0400 Subject: [PATCH] removed email variables from globals module --- mediagoblin/app.py | 6 ------ mediagoblin/auth/lib.py | 2 +- mediagoblin/mg_globals.py | 6 ------ mediagoblin/util.py | 6 +++--- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/mediagoblin/app.py b/mediagoblin/app.py index ae39694f..147db09c 100644 --- a/mediagoblin/app.py +++ b/mediagoblin/app.py @@ -93,12 +93,6 @@ class MediaGoblinApp(object): ####################################################### setup_globals( - # TODO: No need to set these two up as globals, we could - # just read them out of mg_globals.app_config - email_sender_address=app_config['email_sender_address'], - email_debug_mode=app_config['email_debug_mode'], - - # Actual, useful to everyone objects app=self, db_connection=self.connection, database=self.db, diff --git a/mediagoblin/auth/lib.py b/mediagoblin/auth/lib.py index 08bbdd16..6d1aec49 100644 --- a/mediagoblin/auth/lib.py +++ b/mediagoblin/auth/lib.py @@ -112,7 +112,7 @@ def send_verification_email(user, request): # TODO: There is no error handling in place send_email( - mg_globals.email_sender_address, + mg_globals.app_config['email_sender_address'], [user['email']], # TODO # Due to the distributed nature of GNU MediaGoblin, we should diff --git a/mediagoblin/mg_globals.py b/mediagoblin/mg_globals.py index 739f44ee..12a0e016 100644 --- a/mediagoblin/mg_globals.py +++ b/mediagoblin/mg_globals.py @@ -20,12 +20,6 @@ database = None public_store = None queue_store = None -# Dump mail to stdout instead of sending it: -email_debug_mode = False - -# Address for sending out mails -email_sender_address = None - # A WorkBenchManager workbench_manager = None diff --git a/mediagoblin/util.py b/mediagoblin/util.py index 7b1e4a2a..9c4d024a 100644 --- a/mediagoblin/util.py +++ b/mediagoblin/util.py @@ -265,9 +265,9 @@ def send_email(from_addr, to_addrs, subject, message_body): - message_body: email body text """ # TODO: make a mock mhost if testing is enabled - if TESTS_ENABLED or mg_globals.email_debug_mode: + if TESTS_ENABLED or mg_globals.app_config['email_debug_mode']: mhost = FakeMhost() - elif not mg_globals.email_debug_mode: + elif not mg_globals.app_config['email_debug_mode']: mhost = smtplib.SMTP() mhost.connect() @@ -280,7 +280,7 @@ def send_email(from_addr, to_addrs, subject, message_body): if TESTS_ENABLED: EMAIL_TEST_INBOX.append(message) - if getattr(mg_globals, 'email_debug_mode', False): + if mg_globals.app_config['email_debug_mode']: print u"===== Email =====" print u"From address: %s" % message['From'] print u"To addresses: %s" % message['To'] -- 2.25.1