#######################################################
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,
# 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
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
- 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()
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']