From 6a9d94413e7f93777ddd8ba605497bc9bfe4f7ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Tue, 24 Nov 2020 23:40:26 +0100 Subject: [PATCH] Add COPANIER_SITE_URL --- copanier/config.py | 1 + copanier/emails.py | 5 +++-- copanier/templates/base.html | 14 +++++++------- .../delivery/prepare_referent_email.html | 2 +- copanier/templates/emails/access_granted.html | 2 +- copanier/templates/emails/access_granted.txt | 2 +- copanier/templates/emails/order_summary.html | 2 +- copanier/templates/emails/order_summary.txt | 2 +- copanier/templates/products/list_products.html | 2 +- copanier/views/core.py | 17 +++++++++++++++-- copanier/views/delivery.py | 2 ++ copanier/views/login.py | 4 ++-- tests/test_views_delivery.py | 5 +++-- 13 files changed, 39 insertions(+), 21 deletions(-) diff --git a/copanier/config.py b/copanier/config.py index c62a8e9..c813fff 100644 --- a/copanier/config.py +++ b/copanier/config.py @@ -15,6 +15,7 @@ STAFF = [] LOCALE = "fr_FR.UTF-8" #LOCALE = "en_US.UTF-8" SITE_NAME = "Copanier" +SITE_URL = "http://localhost:2244" SITE_DESCRIPTION = "Shared orders" EMAIL_SIGNATURE = "The kind people behind copanier" diff --git a/copanier/emails.py b/copanier/emails.py index 1aac560..44d38bd 100644 --- a/copanier/emails.py +++ b/copanier/emails.py @@ -16,7 +16,7 @@ def send(to, subject, body, html=None, copy=None, attachments=None): if not config.SEND_EMAILS: body = body.replace("https", "http") - return print("Sending email", str(body)) + return print("Sending email", str(body.encode('utf-8'))) message.send( to=to, @@ -37,7 +37,7 @@ def send_from_template(env, template, to, subject, **params): send(to, subject, body=txt, html=html) -def send_order(request, env, person, delivery, order, group_id): +def send_order(request, env, person, delivery, order, group_id, **kwargs): send_from_template( env, "order_summary", @@ -48,4 +48,5 @@ def send_order(request, env, person, delivery, order, group_id): delivery=delivery, request=request, group_id=group_id, + **kwargs, ) diff --git a/copanier/templates/base.html b/copanier/templates/base.html index 910c3a7..6e4a52f 100644 --- a/copanier/templates/base.html +++ b/copanier/templates/base.html @@ -7,11 +7,11 @@ {% if title %}{{ title }} - {% endif %}{{ config.SITE_NAME }} - - - - - + + + + + {% block head %} {% endblock head %} @@ -60,8 +60,8 @@ - - + + {% if message %}