From 3d81977dbd3e69caae28546572446d2dfeb654be Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 10 Feb 2020 17:51:09 +0100 Subject: [PATCH] Side identifiers cannot begin with le/la/les/l'/the --- entrypoint.sh | 28 +++++++++++++++------------- media/forms.py | 9 ++++++++- requirements.txt | 2 +- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index aa2d908..96fcc64 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -11,19 +11,21 @@ sleep 2 python manage.py migrate python manage.py collectstatic --no-input +python manage.py runserver 0.0.0.0:8000 + # harakiri parameter respawns processes taking more than 20 seconds # max-requests parameter respawns processes after serving 5000 requests # vacuum parameter cleans up when stopped -uwsgi --chdir="$(pwd)" \ - --module=med.wsgi:application \ - --env DJANGO_SETTINGS_MODULE=med.settings \ - --master \ - --pidfile="$(pwd)/uwsgi.pid" \ - --socket="$(pwd)/uwsgi.sock" \ - --processes=5 \ - --chmod-socket=600 \ - --harakiri=20 \ - --max-requests=5000 \ - --vacuum \ - --daemonize="$(pwd)/uwsgi.log" \ - --protocol=fastcgi \ No newline at end of file +#uwsgi --chdir="$(pwd)" \ +# --module=med.wsgi:application \ +# --env DJANGO_SETTINGS_MODULE=med.settings \ +# --master \ +# --pidfile="$(pwd)/uwsgi.pid" \ +# --socket="$(pwd)/uwsgi.sock" \ +# --processes=5 \ +# --chmod-socket=600 \ +# --harakiri=20 \ +# --max-requests=5000 \ +# --vacuum \ +# --daemonize="$(pwd)/uwsgi.log" \ +# --protocol=fastcgi \ No newline at end of file diff --git a/media/forms.py b/media/forms.py index b38e091..b1a8f40 100644 --- a/media/forms.py +++ b/media/forms.py @@ -3,6 +3,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later import json +import re import urllib.request import unicodedata @@ -109,9 +110,15 @@ class MediaAdminForm(ModelForm): author_name = self.cleaned_data['authors'][0].name if ',' not in author_name and ' ' in author_name: author_name = author_name.split(' ')[-1] + title_normalized = self.cleaned_data['title'].upper() + title_normalized = re.sub(r'^LE ', '', title_normalized) + title_normalized = re.sub(r'^LA ', '', title_normalized) + title_normalized = re.sub(r'^LES ', '', title_normalized) + title_normalized = re.sub(r'^L\'', '', title_normalized) + title_normalized = re.sub(r'^THE ', '', title_normalized) side_identifier = "{:.3} {:.3}".format( author_name, - self.cleaned_data['title'], ) + title_normalized.replace(' ', ''), ) if self.cleaned_data['subtitle']: start = self.cleaned_data['subtitle'].split(' ')[0] \ diff --git a/requirements.txt b/requirements.txt index 2e68d39..f02f58e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,6 +9,6 @@ python-stdnum==1.10 djangorestframework==3.9.2 pyyaml==3.13 coreapi==2.3.3 -psycopg2==2.7.7 +psycopg2 uwsgi==2.0.18 mysqlclient==1.4.3