Revision a6459f32 snf-astakos-app/astakos/im/management/commands/user-set-initial-quota.py
b/snf-astakos-app/astakos/im/management/commands/user-set-initial-quota.py | ||
---|---|---|
41 | 41 |
from django.core.management.base import BaseCommand, CommandError |
42 | 42 |
from django.core.validators import validate_email |
43 | 43 |
|
44 |
from snf_django.lib.db.transaction import commit_on_success_strict |
|
44 | 45 |
from astakos.im.models import AstakosUser, AstakosUserQuota, Resource |
46 |
from astakos.im.functions import qh_sync |
|
45 | 47 |
|
46 | 48 |
AddResourceArgs = namedtuple('AddQuotaArgs', ('resource', |
47 | 49 |
'capacity', |
... | ... | |
86 | 88 |
help="Do not ask for confirmation"), |
87 | 89 |
) |
88 | 90 |
|
91 |
@commit_on_success_strict() |
|
89 | 92 |
def handle(self, *args, **options): |
90 | 93 |
from_file = options['from_file'] |
91 | 94 |
set_capacity = options['set_capacity'] |
... | ... | |
165 | 168 |
user.add_resource_policy(*args) |
166 | 169 |
except Exception as e: |
167 | 170 |
raise CommandError("Failed to add policy: %s" % e) |
171 |
qh_sync([user.id]) |
|
168 | 172 |
|
169 | 173 |
def import_from_file(self, location): |
170 | 174 |
try: |
Also available in: Unified diff