Changeset - 4d92fdd67af4
[Not reviewed]
default
0 3 0
Dennis Fink - 10 years ago 2015-02-16 18:42:38
dennis.fink@c3l.lu
Updated gnupg code
3 files changed with 9 insertions and 5 deletions:
0 comments (0 inline, 0 general)
ennstatus/__init__.py
Show inline comments
 
@@ -44,12 +44,13 @@ def create_app():
 

	
 
    from .log import init_logging
 
    init_logging(app)
 

	
 
    if 'ENNSTATUS_GPG_HOME' in app.config:
 
        gpg = gnupg.GPG(gnupghome=app.config['ENNSTATUS_GPG_HOME'])
 
        gpg.encoding = 'utf-8'
 
        app.extensions['gnupg'] = gpg
 
    else:
 
        app.extensions['gnupg'] = False
 

	
 
    @app.errorhandler(404)
 
    def page_not_found(e):
ennstatus/root/functions.py
Show inline comments
 
@@ -22,16 +22,19 @@ def send_membership_mail(form):
 
                               street=form.street.data,
 
                               zip=form.zip.data,
 
                               city=form.city.data,
 
                               country=form.country.data,
 
                               gpg=form.gpg.data
 
                               )
 

	
 
        current_app.logger.debug('Before encryption')
 
        current_app.logger.debug(body)
 
        if current_app.extensions['gnupg']:
 
            body = current_app.extensions['gnupg'].encrypt(body, recipient,
 
                                                           always_trust=True)
 
            body = str(current_app.extensions['gnupg'].encrypt(body, recipient,
 
                                                               always_trust=True))
 
            current_app.logger.debug('After encryption')
 
            current_app.logger.debug(body)
 
        msg.body = body
 

	
 
        mail.send(msg)
 
        flash('Application successfully sended!', 'success')
 
    except KeyError:
 
        flash('Internal server error! Please get in touch with us at info@enn.lu!', 'error')
ennstatus/status/functions.py
Show inline comments
 
@@ -24,14 +24,14 @@ def _send_mail(server_name, last_updated
 
        msg.add_recipient(recipient)
 

	
 
        body = ('%s went offline. I received the last update at %s'
 
                % (server_name, last_updated))
 

	
 
        if current_app.extensions['gnupg']:
 
            body = current_app.extensions['gnupg'].encrypt(body, recipient,
 
                                                           always_trust=True)
 
            body = str(current_app.extensions['gnupg'].encrypt(body, recipient,
 
                                                           always_trust=True))
 
        msg.body = body
 

	
 
        mail.send(msg)
 
    except KeyError:
 
        current_app.logger.error('Admin for %s not found!' % server_name)
 
    except AssertionError:
0 comments (0 inline, 0 general)