From 9f86eeed1eadb0e6c6fdc97fba1b7b0c55d3a284 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Sun, 26 Mar 2017 15:54:55 +0200 Subject: Oui --- management/commands/listtimetables.py | 1 - 1 file changed, 1 deletion(-) (limited to 'management/commands') diff --git a/management/commands/listtimetables.py b/management/commands/listtimetables.py index c5ef41f..e4b782f 100644 --- a/management/commands/listtimetables.py +++ b/management/commands/listtimetables.py @@ -27,7 +27,6 @@ class Command(BaseCommand): def handle(self, *args, **options): timetables = Timetable.objects.all() if options["order_by_id"]: - print("oui") timetables = timetables.order_by("id") else: timetables = timetables.order_by("name") -- cgit v1.2.1 From df8f43e5af448a7d635e762e15ff906ab76565f1 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Sun, 26 Mar 2017 17:50:14 +0200 Subject: Affichage d'un compteur d'erreurs de traitement --- management/commands/timetables.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'management/commands') diff --git a/management/commands/timetables.py b/management/commands/timetables.py index d39075d..d596233 100644 --- a/management/commands/timetables.py +++ b/management/commands/timetables.py @@ -64,6 +64,8 @@ class Command(BaseCommand): def handle(self, *args, **options): year = None + errcount = 0 + if options["week"] is None: _, week, day = timezone.now().isocalendar() if day >= 6: @@ -84,5 +86,9 @@ class Command(BaseCommand): process_timetable(timetable, year, weeks) except Exception as e: self.stderr.write(self.style.ERROR("Failed to process {0}: {1}".format(timetable, e))) + errcount += 1 - self.stdout.write(self.style.SUCCESS("Done.")) + if errcount == 0: + self.stdout.write(self.style.SUCCESS("Done.")) + else: + self.stdout.write(self.style.ERROR("Done with {0} errors.".format(errcount))) -- cgit v1.2.1