# HG changeset patch # User Dennis Fink # Date 2015-02-16 18:42:38 # Node ID 4d92fdd67af4f2d61678f1395be359c0cf271c65 # Parent 43a5baeb35adcda4b9a46d6d50ef826eadab465e Updated gnupg code diff --git a/ennstatus/__init__.py b/ennstatus/__init__.py --- a/ennstatus/__init__.py +++ b/ennstatus/__init__.py @@ -47,6 +47,7 @@ def create_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 diff --git a/ennstatus/root/functions.py b/ennstatus/root/functions.py --- a/ennstatus/root/functions.py +++ b/ennstatus/root/functions.py @@ -25,10 +25,13 @@ def send_membership_mail(form): 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) diff --git a/ennstatus/status/functions.py b/ennstatus/status/functions.py --- a/ennstatus/status/functions.py +++ b/ennstatus/status/functions.py @@ -27,8 +27,8 @@ def _send_mail(server_name, last_updated % (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)