Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fallback IDatasetForm plugins should force type, no fallback should force type='dataset' #2083

Merged
merged 4 commits into from
Dec 11, 2014

Conversation

wardi
Copy link
Contributor

@wardi wardi commented Nov 24, 2014

Problem 1

IDatasetForm plugins may have an is_fallback() method that returns True. Such a plugin may also have a package_types() method that returns something other than ['dataset'].

In this case package_create with no type value will use the one plugin to validate dataset fields, but the dataset will be saved with type='dataset' possibly causing a different plugin to be used for package_update.

Problem 2

IDatasetForm plugins may have an is_fallback() method that returns False. Such a plugin may also have a package_types() method that returns ['dataset'].

In this case package_create with no type will use the DefaultDatasetForm validate dataset fields, but the dataset will be saved with type='dataset' causing the plugin to be used for package_update.

@davidread davidread added the WIP label Nov 25, 2014
@wardi wardi removed the WIP label Nov 25, 2014
package_type = package_plugin.package_types()[0]
except (AttributeError, IndexError):
package_type = 'dataset'
# in case a 'dataset' plugin was registeres w/o fallback
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo - "registeres"

@amercader amercader self-assigned this Dec 2, 2014
@amercader amercader added this to the CKAN 2.3 milestone Dec 11, 2014
@amercader amercader merged commit 7459907 into ckan:master Dec 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants