Coverage for bookie.lib.message : 77%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
"""Create and send messages to users
"""
# notification statuses # might have pending, sent, failed 'pending': 0, 'sent': 1, 'failed': 2, 'not_sent': 3, 'error': 4, }
else: return True
"""This is a base email message we can then tweak"""
"""Start up a basic message"""
# need ot setup/override in the extending classes
"""Return the completed message template body
""" return "Test email message from bookie" # lookup = config['pylons.app_globals'].mako_lookup # template = lookup.get_template(template_file)
# # template vars are a combo of the obj dict and the extra dict # template_vars = {'data': message_data} # return template.render(**template_vars)
"""Send the message with the given subject
body can be sent as part of send() or it can be set to the object as msg.body = "xxx"
"""
print msg.as_string() return MSG_STATUS['sent'] else:
else: mail_server = smtplib.SMTP(smtp_server) mail_server.sendmail(msg['From'], all_emails, msg.as_string()) mail_server.quit()
except smtplib.SMTPException: LOG.error( "SMTP Error sending notice for: {0} ".format( str(msg))) return MSG_STATUS['error']
"""Send an email for a reactivation email"""
"""Return the completed message template body
""" Hello {username}:
Please activate your Bookie account by clicking on the following url:
{url}
--- The Bookie Team""".format(**message_data) # lookup = config['pylons.app_globals'].mako_lookup # template = lookup.get_template(template_file)
# # template vars are a combo of the obj dict and the extra dict # template_vars = {'data': message_data} # return template.render(**template_vars)
"""Send an email that you've been invited to the system""" """Return the completed message template body
""" return """ You've been invited to Bookie, a web service for managing your bookmarks!
Please click the link below to activate your account.
{0}
We currently support importing from Google Bookmarks and Delicious exports. Importing from a Chrome or Firefox export does work, however it reads the folder names in as tags. So be aware of that.
Get the Chrome extension from the Chrome web store: https://chrome.google.com/webstore/detail/knnbmilfpmbmlglpeemajjkelcbaaega
If you have any issues feel free to join #bookie on freenode.net or report the issue or idea on http://github.com/mitechie/Bookie/issues.
We also encourage you to sign up for our mailing list at: https://groups.google.com/forum/#!forum/bookie_bookmarks
and our Twitter account: http://twitter.com/BookieBmarks
Bookie is open source. Check out the source at: https://github.com/mitechie/Bookie
--- The Bookie Team""".format(message_data)
"""Send an email that the import has failed."""
"""Build the email message body."""
msg = """ The import for user {username} has failed to import. The path to the import is:
{file_path}
Error:
{exc}
""".format(**message_data) return msg
"""Send an email to the user their import has failed."""
"""Build the email message body."""
msg = """ Your import has failed. The error is listed below. Please file a bug at https://github.com/mitechie/bookie/issues if this error continues. You may also join #bookie on freenode irc if you wish to aid in debugging the issue. If the error pertains to a specific bookmark in your import file you might try removing it and importing the file again.
Error ----------
{exc}
A copy of this error has been logged and will be looked at.
--- The Bookie Team""".format(**message_data) return msg
"""Send an email to the user after a successful import."""
"""Build the email message body."""
msg = """ Your bookmark import is complete! We've begun processing your bookmarks to load their page contents and fulltext index them. This process might take a while if you have a large number of bookmarks. Check out your imported bookmarks at https://bmark.us/{username}/recent.
--- The Bookie Team""".format(**message_data) return msg |