Revision cb0c401a snf-astakos-app/astakos/im/management/commands/astakos-quota.py
b/snf-astakos-app/astakos/im/management/commands/astakos-quota.py | ||
---|---|---|
74 | 74 |
user_ident = options['user'] |
75 | 75 |
|
76 | 76 |
if user_ident is not None: |
77 |
if verify: |
|
78 |
raise CommandError("Cannot combine `--user' option " |
|
79 |
"with `--verify' or `--sync'.") |
|
80 |
|
|
81 |
log = self.run_sync_user(user_ident) |
|
77 |
log = self.run_sync_user(user_ident, sync) |
|
82 | 78 |
else: |
83 | 79 |
log = self.run(sync) |
84 | 80 |
|
... | ... | |
91 | 87 |
self.list_quotas(qh_l, qh_c, astakos_i, info) |
92 | 88 |
|
93 | 89 |
@transaction.commit_on_success |
94 |
def run_sync_user(self, user_ident): |
|
90 |
def run_sync_user(self, user_ident, sync):
|
|
95 | 91 |
if is_uuid(user_ident): |
96 | 92 |
try: |
97 | 93 |
user = AstakosUser.objects.get(uuid=user_ident) |
... | ... | |
107 | 103 |
else: |
108 | 104 |
raise CommandError('Please specify user by uuid or email') |
109 | 105 |
|
106 |
if not user.email_verified and sync: |
|
107 |
raise CommandError('User %s is not verified.' % user.uuid) |
|
108 |
|
|
110 | 109 |
try: |
111 |
return sync_users([user], sync=False)
|
|
110 |
return sync_users([user], sync=sync)
|
|
112 | 111 |
except BaseException, e: |
113 | 112 |
logger.exception(e) |
114 | 113 |
raise CommandError("Failed to compute quotas.") |
Also available in: Unified diff