##// END OF EJS Templates
Invalidate signatures along with global ID content
neko259 -
r1565:72507874 default
parent child Browse files
Show More
@@ -1,20 +1,22 b''
1 from django.core.management import BaseCommand
1 from django.core.management import BaseCommand
2 from django.db import transaction
2 from django.db import transaction
3
3
4 from boards.models import GlobalId
4 from boards.models import GlobalId
5
5
6 __author__ = 'neko259'
6 __author__ = 'neko259'
7
7
8
8
9 class Command(BaseCommand):
9 class Command(BaseCommand):
10 help = 'Removes local global ID cache'
10 help = 'Removes local global ID cache'
11
11
12 @transaction.atomic
12 @transaction.atomic
13 def handle(self, *args, **options):
13 def handle(self, *args, **options):
14 count = 0
14 count = 0
15 for global_id in GlobalId.objects.all():
15 for global_id in GlobalId.objects.exclude(content__isnull=True).exclude(
16 content=''):
16 if global_id.is_local() and global_id.content is not None:
17 if global_id.is_local() and global_id.content is not None:
17 global_id.content = None
18 global_id.content = None
18 global_id.save()
19 global_id.save()
20 global_id.signature_set.all().delete()
19 count += 1
21 count += 1
20 print('Invalidated {} caches.'.format(count))
22 print('Invalidated {} caches.'.format(count))
General Comments 0
You need to be logged in to leave comments. Login now