Skip to content

Commit

Permalink
[ckan#3816] consistent for_edit context value
Browse files Browse the repository at this point in the history
  • Loading branch information
wardi authored and jguo144 committed Jul 5, 2018
1 parent 7be127c commit 583b04e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions ckan/controllers/package.py
Expand Up @@ -674,11 +674,12 @@ def new_resource(self, id, data=None, errors=None, error_summary=None):

data['package_id'] = id
try:
update_context = dict(context, for_edit=True)
if resource_id:
data['id'] = resource_id
get_action('resource_update')(context, data)
get_action('resource_update')(update_context, data)
else:
get_action('resource_create')(context, data)
get_action('resource_create')(update_context, data)
except ValidationError, e:
errors = e.error_dict
error_summary = e.error_summary
Expand Down
2 changes: 1 addition & 1 deletion ckanext/datastore/plugin.py
Expand Up @@ -182,7 +182,7 @@ def after_delete(self, context, resources):
def after_create(self, context, resource):
if not context.get('for_edit', False):
return
if resource.get['query']:
if resource.get('query'):
sync_query_frontend(resource['id'], resource['query'])

def before_update(self, context, old, new):
Expand Down

0 comments on commit 583b04e

Please sign in to comment.