From 0bde2f196cbad22e06609cdd752fe250c3ff6f04 Mon Sep 17 00:00:00 2001 From: Sean Hammond Date: Wed, 13 Feb 2013 17:55:28 +0100 Subject: [PATCH] Don't put api version in context when creating datasets in web ui 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. --- ckan/controllers/package.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/ckan/controllers/package.py b/ckan/controllers/package.py index 08a5527eece..e177622713a 100644 --- a/ckan/controllers/package.py +++ b/ckan/controllers/package.py @@ -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} @@ -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})