Fix template tags to make tox happy

This commit is contained in:
Yohann D'ANELLO 2020-03-11 15:13:34 +01:00
parent a128ed4803
commit 58ea6abce4
7 changed files with 22 additions and 12 deletions

View File

@ -17,6 +17,9 @@ from .models import Changelog
EXCLUDED = [
'admin.logentry',
'authtoken.token',
'cas_server.proxygrantingticket',
'cas_server.proxyticket',
'cas_server.serviceticket',
'cas_server.user',
'cas_server.userattributes',
'contenttypes.contenttype',

View File

@ -1,12 +1,7 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from django import template
from . import getenv
from . import pretty_money
from .getenv import getenv
from .pretty_money import pretty_money
register = template.Library()
register.filter('getenv', getenv)
register.filter('pretty_money', pretty_money)
print(getenv, pretty_money, file=None) # Useless, but tox is happy

View File

@ -1,8 +1,14 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from django import template
import os
def getenv(value):
return os.getenv(value)
register = template.Library()
register.filter('getenv', getenv)

View File

@ -1,6 +1,8 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from django import template
def pretty_money(value):
if value % 100 == 0:
@ -14,3 +16,7 @@ def pretty_money(value):
abs(value) // 100,
abs(value) % 100,
)
register = template.Library()
register.filter('pretty_money', pretty_money)

View File

@ -51,7 +51,7 @@ except ImportError:
if "cas" in INSTALLED_APPS:
MIDDLEWARE += ['cas.middleware.CASMiddleware']
# CAS Settings
CAS_SERVER_URL = "https://" + os.getenv("NOTE_URL") + "/cas/"
CAS_SERVER_URL = "https://" + os.getenv("NOTE_URL", "note.example.com") + "/cas/"
CAS_AUTO_CREATE_USER = False
CAS_LOGO_URL = "/static/img/Saperlistpopette.png"
CAS_FAVICON_URL = "/static/favicon/favicon-32x32.png"

View File

@ -39,7 +39,7 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# EMAIL_HOST_USER = 'change_me'
# EMAIL_HOST_PASSWORD = 'change_me'
SERVER_EMAIL = 'no-reply@' + os.getenv("DOMAIN")
SERVER_EMAIL = 'no-reply@' + os.getenv("DOMAIN", "example.com")
# Security settings
SECURE_CONTENT_TYPE_NOSNIFF = False

View File

@ -39,7 +39,7 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# EMAIL_HOST_USER = 'change_me'
# EMAIL_HOST_PASSWORD = 'change_me'
SERVER_EMAIL = 'no-reply@' + os.getenv("DOMAIN")
SERVER_EMAIL = 'no-reply@' + os.getenv("DOMAIN", "example.com")
# Security settings
SECURE_CONTENT_TYPE_NOSNIFF = False
@ -51,4 +51,4 @@ X_FRAME_OPTIONS = 'DENY'
SESSION_COOKIE_AGE = 60 * 60 * 3
# CAS Client settings
CAS_SERVER_URL = "https://" + os.getenv("NOTE_URL") + "/cas/"
CAS_SERVER_URL = "https://" + os.getenv("NOTE_URL", "note.example.com") + "/cas/"