aboutsummaryrefslogtreecommitdiff
path: root/management/commands/timetables.py
diff options
context:
space:
mode:
authorAlban Gruin2017-10-14 11:25:46 +0200
committerAlban Gruin2017-10-14 11:25:46 +0200
commit640496deb262349101567de12d2476cbfe5065b3 (patch)
treef3a0f6a102abbb0e41995e1d750c8fcc774efb55 /management/commands/timetables.py
parente2fb71d3377dee14cf1934ac3d6ad448bb7063bc (diff)
timezone.now() retourne l’heure UTC, ce qui empêche la mise à jour de
la semaine prochaine le samedi à minuit. Remplacement de ces appels par une fonction qui retourne la bonne heure dans le bon fuseau horaire.
Diffstat (limited to 'management/commands/timetables.py')
-rw-r--r--management/commands/timetables.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/management/commands/timetables.py b/management/commands/timetables.py
index a152f9e..35fb26e 100644
--- a/management/commands/timetables.py
+++ b/management/commands/timetables.py
@@ -21,7 +21,7 @@ from django.db.models import Min
from django.utils import timezone
from edt.models import Course, Timetable
-from edt.utils import get_week
+from edt.utils import get_week, tz_now
from ._private import delete_courses_in_week, get_events, get_update_date, get_weeks, get_xml
@transaction.atomic
@@ -32,7 +32,7 @@ def process_timetable_week(timetable, soup, weeks_in_soup, force, year=None, wee
if force:
today = begin
else:
- today = timezone.make_aware(datetime.datetime.now())
+ today = tz_now()
# On récupère la mise à jour la plus ancienne dans les cours de l’emploi du temps
# commençant à partir de maintenant
@@ -107,16 +107,16 @@ class Command(BaseCommand):
if options["all"]:
weeks = None
elif options["week"] is None:
- _, week, day = timezone.now().isocalendar()
+ _, week, day = tz_now().isocalendar()
if day >= 6:
- year, week, _ = (timezone.now() + datetime.timedelta(weeks=1)).isocalendar()
+ year, week, _ = (tz_now() + datetime.timedelta(weeks=1)).isocalendar()
weeks = [week]
else:
weeks = options["week"]
if not options["all"]:
if options["year"] is None and year is None:
- year = timezone.now().year
+ year = tz_now().year
elif year is None:
year = options["year"][0]