Skip to content
Snippets Groups Projects
Commit 3308a3df authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

fix: misc python3 changes

parent 38d691f6
No related branches found
No related tags found
1 merge request!261Python3 translation
...@@ -3,21 +3,21 @@ asn1crypto==0.24.0 ...@@ -3,21 +3,21 @@ asn1crypto==0.24.0
Babel==2.6.0 Babel==2.6.0
backports.functools-lru-cache==1.5 backports.functools-lru-cache==1.5
certifi==2018.8.24 certifi==2018.8.24
cffi==1.11.5 cffi==1.14.2
chardet==3.0.4 chardet==3.0.4
coverage==4.5.1 coverage==4.5.1
cryptography==2.3.1 cryptography==2.3.1
cycler==0.10.0 cycler==0.10.0
Django==1.11.5 Django==1.11.17
django-cleanup==0.4.2 django-cleanup==4.0.0
django-common-helpers==0.9.2 django-common-helpers==0.9.2
django-cron==0.5.0 django-cron==0.5.0
django-excel==0.0.9 django-excel==0.0.9
django-formtools==2.1 django-formtools==2.2
django-otp==0.5.0 django-otp==0.9.4
django-phonenumber-field==1.3.0 django-phonenumber-field==1.3.0
django-stronghold==0.2.9 django-stronghold==0.2.9
django-two-factor-auth==1.6.1 django-two-factor-auth==1.9.1
enum34==1.1.6 enum34==1.1.6
Faker==0.9.2 Faker==0.9.2
funcsigs==1.0.2 funcsigs==1.0.2
...@@ -25,30 +25,30 @@ gunicorn==19.6.0 ...@@ -25,30 +25,30 @@ gunicorn==19.6.0
idna==2.7 idna==2.7
ipaddress==1.0.22 ipaddress==1.0.22
kiwisolver==1.0.1 kiwisolver==1.0.1
lml==0.0.1 lml==0.0.4
luhn==0.2.0 luhn==0.2.0
lxml==3.7.3 lxml==4.5.2
matplotlib==2.2.3 matplotlib==2.2.3
mockito==1.1.1 mockito==1.1.1
nexmo==2.3.0 nexmo==2.3.0
numpy==1.15.2 numpy==1.15.4
pandas==0.23.4 pandas==1.1.3
phonenumberslite==8.9.14 phonenumberslite==8.9.14
Pillow==3.4.2 Pillow==3.4.2
psycopg2==2.7.6.1 psycopg2==2.8.6
pycparser==2.19 pycparser==2.19
pyexcel==0.5.3 pyexcel==0.6.4
pyexcel-io==0.5.9.1 pyexcel-io==0.5.19
pyexcel-webio==0.1.4 pyexcel-webio==0.1.4
pyexcel-xls==0.5.0 pyexcel-xls==0.5.9
PyJWT==1.6.4 PyJWT==1.6.4
pyparsing==2.2.2 pyparsing==2.2.2
python-dateutil==2.7.3 python-dateutil==2.7.3
python-docx==0.8.6 python-docx==0.8.6
pytz==2016.10 pytz==2017.2
qrcode==4.0.4 qrcode==4.0.4
requests==2.19.1 requests==2.19.1
six==1.11.0 six==1.15.0
sqlparse==0.2.4 sqlparse==0.2.4
subprocess32==3.5.2 subprocess32==3.5.2
text-unidecode==1.2 text-unidecode==1.2
......
...@@ -19,6 +19,8 @@ from django.conf.urls import url, include ...@@ -19,6 +19,8 @@ from django.conf.urls import url, include
from django.conf.urls.static import static from django.conf.urls.static import static
from django.contrib import admin from django.contrib import admin
from two_factor.urls import urlpatterns as tf_urls
from web import api_urls from web import api_urls
from web import urls from web import urls
...@@ -26,5 +28,5 @@ urlpatterns = [ ...@@ -26,5 +28,5 @@ urlpatterns = [
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url(r'', include(urls)), url(r'', include(urls)),
url(r'^api/', include(api_urls)), url(r'^api/', include(api_urls)),
url(r'', include('two_factor.urls', 'two_factor')) url(r'', include(tf_urls)),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
...@@ -15,6 +15,6 @@ class Migration(migrations.Migration): ...@@ -15,6 +15,6 @@ class Migration(migrations.Migration):
migrations.AddField( migrations.AddField(
model_name='holiday', model_name='holiday',
name='kind', name='kind',
field=models.CharField(choices=[(b'H', b'Holiday'), (b'X', b'Extra Availability')], default=b'H', max_length=1), field=models.CharField(choices=[(b'H', b'Holiday'), (b'X', b'Extra Availability')], default=b'H', max_length=16),
), ),
] ]
...@@ -36,12 +36,20 @@ def setlocale(name): ...@@ -36,12 +36,20 @@ def setlocale(name):
def get_formatted_time(time_format): def get_formatted_time(time_format):
return now.strftime(time_format).decode(date_format_encoding()) # TODO: 2TO3 removed string decoding using the locale
# Was:
# return now.strftime(time_format).decode(date_format_encoding())
# Is:
return now.strftime(time_format) # /-->
def date_to_str(date, format): def date_to_str(date, format):
if date is not None: if date is not None:
return date.strftime(format).decode(date_format_encoding()) # TODO: 2TO3 removed string decoding using the locale
# Was:
# return date.strftime(format).decode(date_format_encoding())
# Is:
return date.strftime(format) # /-->
else: else:
return "" return ""
...@@ -243,8 +251,14 @@ class MailTemplate(models.Model): ...@@ -243,8 +251,14 @@ class MailTemplate(models.Model):
if worker is not None: if worker is not None:
email = worker.email email = worker.email
return { return {
"##DATE_FULL##": current_datetime.strftime(DATE_FORMAT_FULL).decode(date_format_encoding()), # TODO: 2to3
"##DATE_SHORT##": current_datetime.strftime(DATE_FORMAT_SHORT).decode(date_format_encoding()), # Was:
# "##DATE_FULL##": current_datetime.strftime(DATE_FORMAT_FULL).decode(date_format_encoding()),
# "##DATE_SHORT##": current_datetime.strftime(DATE_FORMAT_SHORT).decode(date_format_encoding()),
# Is:
"##DATE_FULL##": current_datetime.strftime(DATE_FORMAT_FULL),
"##DATE_SHORT##": current_datetime.strftime(DATE_FORMAT_SHORT),
# /-->
"##WORKER##": str(worker), "##WORKER##": str(worker),
"##WORKER_EMAIL##": email "##WORKER_EMAIL##": email
} }
...@@ -261,12 +275,19 @@ class MailTemplate(models.Model): ...@@ -261,12 +275,19 @@ class MailTemplate(models.Model):
worker_phone_number = "" worker_phone_number = ""
worker_email_address = "" worker_email_address = ""
if appointment.datetime_when is not None: if appointment.datetime_when is not None:
appointment_date_full = appointment.datetime_when.strftime(DATETIME_FORMAT).decode( # TODO: 2to3
date_format_encoding()) # Was:
appointment_date_short = appointment.datetime_when.strftime(DATE_FORMAT_SHORT).decode( #appointment_date_full = appointment.datetime_when.strftime(DATETIME_FORMAT).decode(
date_format_encoding()) # date_format_encoding())
appointment_date_time = appointment.datetime_when.strftime(DATE_FORMAT_TIME).decode( #appointment_date_short = appointment.datetime_when.strftime(DATE_FORMAT_SHORT).decode(
date_format_encoding()) # date_format_encoding())
#appointment_date_time = appointment.datetime_when.strftime(DATE_FORMAT_TIME).decode(
# date_format_encoding())
# Is:
appointment_date_full = appointment.datetime_when.strftime(DATETIME_FORMAT)
appointment_date_short = appointment.datetime_when.strftime(DATE_FORMAT_SHORT)
appointment_date_time = appointment.datetime_when.strftime(DATE_FORMAT_TIME)
# /-->
else: else:
appointment_date_full = appointment_date_short = appointment_date_time = "" appointment_date_full = appointment_date_short = appointment_date_time = ""
return { return {
...@@ -289,11 +310,19 @@ class MailTemplate(models.Model): ...@@ -289,11 +310,19 @@ class MailTemplate(models.Model):
def get_visit_replacements(visit): def get_visit_replacements(visit):
if visit is not None: if visit is not None:
return { return {
"##V_DATE_START_FULL##": visit.datetime_begin.strftime(DATETIME_FORMAT).decode(date_format_encoding()), # TODO: 2to3
"##V_DATE_START_SHORT##": visit.datetime_begin.strftime(DATE_FORMAT_SHORT).decode( # Was:
date_format_encoding()), # "##V_DATE_START_FULL##": visit.datetime_begin.strftime(DATETIME_FORMAT).decode(date_format_encoding()),
"##V_DATE_ENDS_FULL##": visit.datetime_end.strftime(DATETIME_FORMAT).decode(date_format_encoding()), # "##V_DATE_START_SHORT##": visit.datetime_begin.strftime(DATE_FORMAT_SHORT).decode(
"##V_DATE_ENDS_SHORT##": visit.datetime_end.strftime(DATE_FORMAT_SHORT).decode(date_format_encoding()), # date_format_encoding()),
#"##V_DATE_ENDS_FULL##": visit.datetime_end.strftime(DATETIME_FORMAT).decode(date_format_encoding()),
#"##V_DATE_ENDS_SHORT##": visit.datetime_end.strftime(DATE_FORMAT_SHORT).decode(date_format_encoding()),
# Is:
"##V_DATE_START_FULL##": visit.datetime_begin.strftime(DATETIME_FORMAT),
"##V_DATE_START_SHORT##": visit.datetime_begin.strftime(DATE_FORMAT_SHORT),
"##V_DATE_ENDS_FULL##": visit.datetime_end.strftime(DATETIME_FORMAT),
"##V_DATE_ENDS_SHORT##": visit.datetime_end.strftime(DATE_FORMAT_SHORT),
# /-->
} }
return {} return {}
...@@ -381,9 +410,15 @@ class MailTemplate(models.Model): ...@@ -381,9 +410,15 @@ class MailTemplate(models.Model):
"##C_NUMBER##": voucher.number, "##C_NUMBER##": voucher.number,
"##C_PATIENT_NAME##": voucher.study_subject.subject.first_name + ' ' + voucher.study_subject.subject.last_name, "##C_PATIENT_NAME##": voucher.study_subject.subject.first_name + ' ' + voucher.study_subject.subject.last_name,
"##C_VOUCHER_TYPE##": voucher_type, "##C_VOUCHER_TYPE##": voucher_type,
"##C_ISSUE_DATE_SHORT##": voucher.issue_date.strftime(DATE_FORMAT_SHORT).decode(date_format_encoding()), # TODO: 2to3
"##C_EXPIRY_START_SHORT##": voucher.expiry_date.strftime(DATE_FORMAT_SHORT).decode( # Was:
date_format_encoding()), # "##C_ISSUE_DATE_SHORT##": voucher.issue_date.strftime(DATE_FORMAT_SHORT).decode(date_format_encoding()),
# "##C_EXPIRY_START_SHORT##": voucher.expiry_date.strftime(DATE_FORMAT_SHORT).decode(
# date_format_encoding()),
# Is:
"##C_ISSUE_DATE_SHORT##": voucher.issue_date.strftime(DATE_FORMAT_SHORT),
"##C_EXPIRY_START_SHORT##": voucher.expiry_date.strftime(DATE_FORMAT_SHORT),
# /-->
"##C_PARTNER_NAME##": voucher.usage_partner.first_name + ' ' + voucher.usage_partner.last_name, "##C_PARTNER_NAME##": voucher.usage_partner.first_name + ' ' + voucher.usage_partner.last_name,
"##C_PARTNER_ADDRESS##": voucher.usage_partner.address, "##C_PARTNER_ADDRESS##": voucher.usage_partner.address,
"##C_PARTNER_POSTAL_CODE##": voucher.usage_partner.postal_code, "##C_PARTNER_POSTAL_CODE##": voucher.usage_partner.postal_code,
......
...@@ -16,7 +16,7 @@ Including another URLconf ...@@ -16,7 +16,7 @@ Including another URLconf
from django.conf import settings from django.conf import settings
from django.conf.urls import include from django.conf.urls import include
from django.conf.urls import url from django.conf.urls import url
from django.contrib.auth.views import logout from django.contrib.auth import logout
from django.views.defaults import page_not_found from django.views.defaults import page_not_found
from django.views.generic import TemplateView from django.views.generic import TemplateView
......
import logging import logging
from django import forms from django import forms
from django.core.urlresolvers import reverse from django.urls import reverse
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment