Skip to content

Commit

Permalink
[#390] Don't put api version in context when creating datasets in web ui
Browse files Browse the repository at this point in the history
The form_to_db_schema() methods of IDatasetForm plugins were not getting
called when creating datasets in the web interface, if the IDatasetForm
plugin inherits from DefaultDatasetForm.

The reason was that DefaultDatasetForm's form_to_db_schema() method
deliberately doesn't call the method if the dataset is being created via
the API, and the package controller's new_resources() and new_metadata()
methods (for the new three-stage dataset creation) put the API version
in the context, so DefaultDatasetForm thinks it's being used over the
API.

Change the package controller to not put the API version in the context.

Fixes #390.
  • Loading branch information
Sean Hammond committed Feb 13, 2013
1 parent ec8f69c commit b6ccfca
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions ckan/controllers/package.py
Expand Up @@ -594,7 +594,6 @@ def new_resource(self, id, data=None, errors=None, error_summary=None):
del data['id']

context = {'model': model, 'session': model.Session,
'api_version': 3,
'user': c.user or c.author,
'extras_as_string': True}

Expand Down Expand Up @@ -680,7 +679,6 @@ def new_metadata(self, id, data=None, errors=None, error_summary=None):
# we don't want to include save as it is part of the form
del data['save']
context = {'model': model, 'session': model.Session,
'api_version': 3,
'user': c.user or c.author,
'extras_as_string': True}
data_dict = get_action('package_show')(context, {'id': id})
Expand Down

0 comments on commit b6ccfca

Please sign in to comment.