Module Expr Str ImportFrom alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias ImportFrom alias Assign NameStore Call NameLoad NameLoad FunctionDef arguments args defaults body Expr Str Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad Call SubscriptLoad AttributeLoad NameLoad attr Index Str NameLoad attr Assign NameStore Call AttributeLoad Call SubscriptLoad AttributeLoad NameLoad attr Index Str NameLoad attr Assign NameStore Call AttributeLoad Call SubscriptLoad AttributeLoad NameLoad attr Index Str NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Yield Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr With Call NameLoad body Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr attr Str Str Assign NameStore Call AttributeLoad NameLoad attr Str Str Assign NameStore Call AttributeLoad Str attr NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad NameLoad attr Assign NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Str Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad If UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Return Assign NameStore Call NameLoad keyword NameLoad keyword SubscriptLoad AttributeLoad NameLoad attr Index Str keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad body Expr Str Assign NameStore BoolOpOr NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Str If CompareIsNot NameLoad NameLoad body Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad NameLoad NameLoad NameLoad attr Assign NameStore IfExp Call NameLoad NameLoad Str Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr keyword NameLoad keyword Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad If UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Return Assign NameStore Call NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list
N/A N/A Convenience functions for sending email from any view or Celery task. contextlib contextmanager N/A hashlib logging getLogger flask current_app flask.ext.mail Message werkzeug.debug tbtools pypi_portal.extensions mail redis pypi_portal.models.redis EMAIL_THROTTLE N/A LOG N/A getLogger __name__ _override_html N/A N/A N/A N/A N/A Temporarily changes the module constants in `tbtools` to make it email-friendly.

    Gmail strips out everything between <style></style>, so all styling has to be inline using the style="" attribute in
    HTML tags. These changes makes the Flask debugging page HTML (shown when unhandled exceptions are raised with
    DEBUG = True) email-friendly. Designed to be used with the `with` statement.

    It's too bad `tbtools.Traceback` doesn't copy module constants to instance variables where they can be easily
    overridden, ugh!
     N/A old_page_html N/A tbtools PAGE_HTML N/A old_summary N/A tbtools SUMMARY_HTML N/A old_frame N/A tbtools FRAME_HTML N/A email_template N/A N/A N/A current_app jinja_env get_template email.html N/A email_context N/A N/A email_template new_context N/A page_html N/A N/A N/A N/A N/A email_template blocks N/A page_html email_context next N/A summary_html N/A N/A N/A N/A N/A email_template blocks N/A summary_html email_context next N/A frame_html N/A N/A N/A N/A N/A email_template blocks N/A frame_html email_context next N/A N/A tbtools PAGE_HTML page_html N/A N/A tbtools SUMMARY_HTML summary_html N/A N/A tbtools FRAME_HTML frame_html N/A N/A N/A N/A tbtools PAGE_HTML old_page_html N/A N/A tbtools SUMMARY_HTML old_summary N/A N/A tbtools FRAME_HTML old_frame N/A contextmanager send_exception N/A N/A subject N/A N/A N/A Send Python exception tracebacks via email to the ADMINS list.

    Use the same HTML styling as Flask tracebacks in debug web servers.

    This function must be called while the exception is happening. It picks up the raised exception with sys.exc_info().

    Positional arguments:
    subject -- subject line of the email (to be prepended by 'Application Error: ').
     N/A tb N/A N/A tbtools get_current_traceback N/A N/A _override_html N/A N/A html N/A N/A N/A N/A tb render_full encode utf-8 replace N/A html N/A N/A html replace <blockquote> <blockquote style="margin: 1em 0 0; padding: 0;"> N/A subject N/A N/A Application Error: {} format subject N/A md5 N/A N/A N/A N/A hashlib md5 N/A N/A {}{} format subject html hexdigest N/A seconds N/A int N/A N/A current_app config N/A MAIL_EXCEPTION_THROTTLE N/A lock N/A N/A redis lock N/A N/A EMAIL_THROTTLE format md5 md5 timeout seconds N/A have_lock N/A N/A lock acquire blocking False N/A N/A have_lock N/A N/A N/A N/A LOG debug N/A N/A Suppressing email: {} format subject N/A N/A msg N/A Message subject subject recipients N/A N/A current_app config N/A ADMINS html html N/A N/A N/A mail send msg N/A send_email N/A N/A subject body html recipients throttle N/A None None None None N/A N/A Send an email. Optionally throttle the amount an identical email goes out.

    If the throttle argument is set, an md5 checksum derived from the subject, body, html, and recipients is stored in
    Redis with a lock timeout. On the first email sent, the email goes out like normal. But when other emails with the
    same subject, body, html, and recipients is supposed to go out, and the lock hasn't expired yet, the email will be
    dropped and never sent.

    Positional arguments:
    subject -- the subject line of the email.

    Keyword arguments.
    body -- the body of the email (no HTML).
    html -- the body of the email, can be HTML (overrides body).
    recipients -- list or set (not string) of email addresses to send the email to. Defaults to the ADMINS list in the
        Flask config.
    throttle -- time in seconds or datetime.timedelta object between sending identical emails.
     N/A recipients N/A recipients N/A N/A current_app config N/A ADMINS N/A N/A throttle None N/A N/A md5 N/A N/A N/A N/A hashlib md5 N/A N/A {}{}{}{} format subject body html recipients hexdigest N/A seconds N/A N/A hasattr throttle total_seconds N/A N/A throttle total_seconds throttle N/A lock N/A N/A redis lock N/A N/A EMAIL_THROTTLE format md5 md5 timeout N/A int seconds N/A have_lock N/A N/A lock acquire blocking False N/A N/A have_lock N/A N/A N/A N/A LOG debug N/A N/A Suppressing email: {} format subject N/A N/A msg N/A Message subject subject recipients recipients body body html html N/A N/A N/A mail send msg N/A