Commit 664cb001 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis

astakos: Force query eval when used in __in filter

Related to commit aee9a38

Also fix call of qh_sync_users in migration script.
parent 369218ef
......@@ -836,6 +836,7 @@ def _partition_by(f, l):
def count_pending_app(users):
users = list(users)
apps = ProjectApplication.objects.filter(state=ProjectApplication.PENDING,
owner__in=users)
apps_d = _partition_by(lambda a: a.owner.uuid, apps)
......
......@@ -165,6 +165,7 @@ def remove_base_quota(user, resource):
def initial_quotas(users):
users = list(users)
initial = {}
default_quotas = get_default_quota()
......@@ -192,6 +193,7 @@ def get_grant_source(grant):
def astakos_users_quotas(users, initial=None):
users = list(users)
if initial is None:
quotas = initial_quotas(users)
else:
......@@ -274,6 +276,7 @@ def qh_sync_user(user):
def qh_sync_projects(projects):
projects = list(projects)
memberships = ProjectMembership.objects.filter(
project__in=projects, state__in=ProjectMembership.ACTUALLY_ACCEPTED)
users = set(m.person for m in memberships)
......
......@@ -47,7 +47,7 @@ def main():
print "Resource 'astakos.pending_app' not found."
return
userids = set()
users = set()
settings = UserSetting.objects.filter(setting=SETTING)
for setting in settings:
user = setting.user
......@@ -59,9 +59,9 @@ def main():
print "Base quota already exists: %s %s" % (user.uuid, RESOURCE)
continue
print "Migrated base quota: %s %s %s" % (user.uuid, RESOURCE, value)
userids.add(user.id)
users.add(user)
qh_sync_users(userids)
qh_sync_users(users)
if __name__ == '__main__':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment