From b9967d9edd0f6d100a8a26529e8ddf030b591f50 Mon Sep 17 00:00:00 2001 From: Ernesto Rico Schmidt <ernesto@helsinki.at> Date: Thu, 8 Feb 2024 17:55:02 -0400 Subject: [PATCH] fix: ensure we use strings for the messages --- program/management/commands/addpermissions.py | 10 +++++----- program/management/commands/addtimeslots.py | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/program/management/commands/addpermissions.py b/program/management/commands/addpermissions.py index 64f4cb53..24bb9992 100644 --- a/program/management/commands/addpermissions.py +++ b/program/management/commands/addpermissions.py @@ -17,7 +17,7 @@ class Command(BaseCommand): ) self.stdout.flush() program_group.permissions.add(*app_permissions) - self.stdout.write(self.style.SUCCESS(len(app_permissions))) + self.stdout.write(self.style.SUCCESS(str(len(app_permissions)))) host_group = Group.objects.get(name=settings.ENTITLED_GROUPS[0]) model_permissions = Permission.objects.filter( @@ -29,7 +29,7 @@ class Command(BaseCommand): ) self.stdout.flush() host_group.permissions.add(*model_permissions) - self.stdout.write(self.style.SUCCESS(len(model_permissions))) + self.stdout.write(self.style.SUCCESS(str(len(model_permissions)))) host_plus_group = Group.objects.get(name=settings.ENTITLED_GROUPS[1]) change_permissions = Permission.objects.filter( @@ -40,7 +40,7 @@ class Command(BaseCommand): ending="", ) host_plus_group.permissions.add(*change_permissions) - self.stdout.write(self.style.SUCCESS(len(change_permissions))) + self.stdout.write(self.style.SUCCESS(str(len(change_permissions)))) self.stdout.flush() edit_permissions = Permission.objects.filter( codename__startswith="edit", content_type__model__in=["host", "note", "show"] @@ -51,7 +51,7 @@ class Command(BaseCommand): ) self.stdout.flush() host_plus_group.permissions.add(*edit_permissions) - self.stdout.write(self.style.SUCCESS(len(edit_permissions))) + self.stdout.write(self.style.SUCCESS(str(len(edit_permissions)))) self.stdout.write( f"Adding edit permissions on host, note & show to the '{program_group}' group... ", @@ -59,4 +59,4 @@ class Command(BaseCommand): ) self.stdout.flush() program_group.permissions.add(*edit_permissions) - self.stdout.write(self.style.SUCCESS(len(edit_permissions))) + self.stdout.write(self.style.SUCCESS(str(len(edit_permissions)))) diff --git a/program/management/commands/addtimeslots.py b/program/management/commands/addtimeslots.py index 29502212..091e3d72 100644 --- a/program/management/commands/addtimeslots.py +++ b/program/management/commands/addtimeslots.py @@ -60,11 +60,13 @@ class Command(BaseCommand): if dry_run: self.stdout.write( - self.style.WARNING(f"would add {len(timeslots)} timeslots to {schedule}") + self.style.WARNING( + f"would add {str(len(timeslots))} timeslots to {schedule}" + ) ) else: TimeSlot.objects.bulk_create(timeslots, ignore_conflicts=True) self.stdout.write( - self.style.SUCCESS(f"added {len(timeslots)} timeslots to {schedule}") + self.style.SUCCESS(f"added {str(len(timeslots))} timeslots to {schedule}") ) -- GitLab