From 2ca6d88011d772d107862e05c89a34ab03ba299c Mon Sep 17 00:00:00 2001 From: tobes Date: Wed, 3 Oct 2012 10:03:33 +0100 Subject: [PATCH] [#2939] Move the membership adding so that the revision table works --- ckan/logic/action/create.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ckan/logic/action/create.py b/ckan/logic/action/create.py index 50567b109f5..f5caa91c56d 100644 --- a/ckan/logic/action/create.py +++ b/ckan/logic/action/create.py @@ -538,7 +538,13 @@ def _group_or_org_create(context, data_dict, is_org=False): logic.get_action('activity_create')(activity_create_context, activity_dict, ignore_auth=True) + if not context.get('defer_commit'): + model.repo.commit() + context["group"] = group + context["id"] = group.id + # creator of group/org becomes an admin + # this needs to be after the repo.commit or else revisions break member_dict = { 'id': group.id, 'object': user, @@ -547,10 +553,6 @@ def _group_or_org_create(context, data_dict, is_org=False): } logic.get_action('member_create')(context, member_dict) - if not context.get('defer_commit'): - model.repo.commit() - context["group"] = group - context["id"] = group.id log.debug('Created object %s' % str(group.name)) return model_dictize.group_dictize(group, context)