Changeset - 3118e4c11c59
[Not reviewed]
0 2 0
Christopher Neugebauer - 8 years ago 2016-07-02 12:56:44
_@chrisjrn.com
Friday fixes (#36)

* Monkey-patches a version of send_email that allows BCCs into the django accounts signup process. wtf, etc.

* Adds alt-text to site header

* Favicon.
2 files changed with 39 insertions and 2 deletions:
0 comments (0 inline, 0 general)
pinaxcon/monkey_patch.py
Show inline comments
 
from django.conf import settings
 
from django.core.mail import EmailMultiAlternatives
 
from functools import wraps
 

	
 

	
 
class MonkeyPatchMiddleware(object):
...
 
@@ -9,2 +14,3 @@ def do_monkey_patch():
 
    patch_speaker_profile_form()
 
    patch_accounts_to_send_bcc()
 

	
...
 
@@ -17,3 +23,3 @@ def patch_speaker_profile_form():
 
    ''' Replaces textarea widgets with markdown editors. '''
 
    
 

 
    import widgets
...
 
@@ -25 +31,28 @@ def patch_speaker_profile_form():
 
    fields["accessibility"].widget = widgets.AceMarkdownEditor()
 

	
 

	
 
def patch_accounts_to_send_bcc():
 
    ''' Patches django-user-accounts' email functions to send a BCC e-mail to
 
    the default BCC e-mail address. '''
 

	
 
    from account import hooks
 

	
 
    # django-user-accounts always uses send_mail like:
 
    # send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, to)
 

	
 
    if hasattr(settings, "ENVELOPE_BCC_LIST"):
 
        bcc_email = settings.ENVELOPE_BCC_LIST
 
    else:
 
        bcc_email = None
 

	
 
    def send_mail(subject, message, from_email, to):
 
        email = EmailMultiAlternatives(
 
            subject,
 
            message,
 
            from_email,
 
            to,
 
            bcc=bcc_email,
 
        )
 
        email.send()
 

	
 
    hooks.send_mail = send_mail
pinaxcon/templates/site_base.html
Show inline comments
...
 
@@ -18,2 +18,3 @@
 
    <link rel="stylesheet" href="{% static 'lca2017/css/print.css' %}" media="print">
 
    <link rel="icon" href="{% static 'lca2017/images/favicon.ico' %}"
 
    <!--FIXME: download-->
...
 
@@ -49,5 +50,8 @@
 
        {% block site_brand %}
 
          <a href="/">
 
          <a href="/"
 
            title="linux.conf.au | 16–20 January, Hobart | The Future of Open Source"
 
          >
 
            <img src="{% static 'lca2017/images/svgs/lca2017-website-logo.svg' %}"
 
              width="100%"
 
              title="linux.conf.au | 16–20 January, Hobart | The Future of Open Source"
 
              />
0 comments (0 inline, 0 general)