[ckan-changes] [okfn/ckan] ca8753: [#649] Rename default_package_schema() -> _base_pa...
GitHub
noreply at github.com
Wed Mar 20 10:21:04 UTC 2013
Branch: refs/heads/master
Home: https://github.com/okfn/ckan
Commit: ca87536129753ed38e428a830aea0ba10c1343f9
https://github.com/okfn/ckan/commit/ca87536129753ed38e428a830aea0ba10c1343f9
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2013-03-18 (Mon, 18 Mar 2013)
Changed paths:
M ckan/logic/schema.py
M ckan/tests/lib/test_dictization_schema.py
M ckan/tests/schema/test_schema.py
M ckanext/test_tag_vocab_plugin.py
Log Message:
-----------
[#649] Rename default_package_schema() -> _base_package_schema()
Also add a docstring.
This schema seems to be a base schema for other package schemas to be
based on, and a private helper function of schema.py. It's not used
outside of schema.py apart from by some tests that probably should not
be using it. The new name hopefully makes it clearer what the purpose of
this function is.
Commit: 0030d73d7ced558ffa543929a5bbb4a2d5995633
https://github.com/okfn/ckan/commit/0030d73d7ced558ffa543929a5bbb4a2d5995633
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2013-03-18 (Mon, 18 Mar 2013)
Changed paths:
M ckan/logic/schema.py
Log Message:
-----------
[#649] Deprecate package_form_schema() properly
I think package_form_schema() was probably deprecated using a code
comment before we had the Right Way of deprecating things (using the
deprecated decorator).
Commit: 6604d7b7a608f4463725981a82b1c9006dcfbd97
https://github.com/okfn/ckan/commit/6604d7b7a608f4463725981a82b1c9006dcfbd97
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2013-03-18 (Mon, 18 Mar 2013)
Changed paths:
M ckan/controllers/package.py
Log Message:
-----------
[#649] Don't validate package dicts in package controller
The package_*() action functions handle fetching package schemas and
using them to validate package dicts, no need to also do it in the
package controller!
Commit: c9a4c27798509cd7b2ca99b2bdbcdc9279551c6e
https://github.com/okfn/ckan/commit/c9a4c27798509cd7b2ca99b2bdbcdc9279551c6e
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2013-03-18 (Mon, 18 Mar 2013)
Changed paths:
M ckan/logic/action/create.py
Log Message:
-----------
[#649] Delete package_create_validate()
Delete package_create_validate() action function.
This function has no docstring and no tests, and duplicates package dict
validation code in package_create().
Commit: 4abebbc562519ade7b8d17797ca4ec3889c878e7
https://github.com/okfn/ckan/commit/4abebbc562519ade7b8d17797ca4ec3889c878e7
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2013-03-18 (Mon, 18 Mar 2013)
Changed paths:
M ckan/logic/action/update.py
Log Message:
-----------
[#649] Delete package_update_validate()
Delete package_update_validate() action function.
This function has no docstring and no tests, and duplicates package dict
validation code in package_update().
Commit: 3c677cfdfcfbab5a4ff9edd84b85213fe15990cc
https://github.com/okfn/ckan/commit/3c677cfdfcfbab5a4ff9edd84b85213fe15990cc
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2013-03-19 (Tue, 19 Mar 2013)
Changed paths:
M ckan/lib/plugins.py
M ckan/logic/action/create.py
M ckan/logic/action/update.py
M ckan/logic/schema.py
M ckan/tests/lib/test_dictization_schema.py
M ckan/tests/schema/test_schema.py
M ckanext/test_tag_vocab_plugin.py
Log Message:
-----------
[#649] Refactor form_to_db_schema()
Replace form_to_db_schema(), form_to_db_schema_options(),
form_to_db_schema_api_create(), form_to_db_schema_api_update(),
form_to_db_package_schema() with just two schemas: create and update.
Then get the tests passing.
schema.py:
- Delete _base_package_schema()
- Delete already deprecated package_form_schema()
- Delete form_to_db_package_schema()
- Tweak default_create_package_schema() and
default_update_package_schema() to get tests passing
DefaultDatasetForm:
- Delete form_to_db_schema_options()
- Delete form_to_db_schema()
- Delete form_to_db_schema_api_create()
- Delete form_to_db_schema_api_update()
- Add create_package_schema(), returns None
- Add update_package_schema(), returns None
Note that by deleting form_to_db_schema() and
form_to_db_schema_options(), _api_create() and _api_update(), we're
breaking backwards compatibility with any plugins that were using these.
package_create():
- Don't call form_to_db_schema_options() or form_to_db_schema().
- Instead call the package plugin's create_package_schema(), if that
doesn't exist or if it returns None then call
default_create_package_schema() instead
package_update():
- Don't call form_to_db_schema_options() or form_to_db_schema().
- Instead call the package plugin's update_package_schema(), if that
doesn't exist or if it returns None then call
default_update_package_schema() instead
Note that by no longer calling the form_to_db_schema_options() or
form_to_db_schema() methods of IDatasetForm plugins, we're breaking
backward compatibility with those plugins.
Note this makes IDatasetForm less flexible - plugins can return
different schemas for creating, updating or showing packages, but they
can no longer return different schemas depending on whether we're using
the API or web UI, or on other parameters from the Pylons context.
test_tag_vocab.py:
- Update MockVocabTagsPlugin to work with the new interface
Also update some other tests.
Commit: b763aa5375d936c6bf8e7d79204e9d5035520138
https://github.com/okfn/ckan/commit/b763aa5375d936c6bf8e7d79204e9d5035520138
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2013-03-19 (Tue, 19 Mar 2013)
Changed paths:
M ckan/lib/plugins.py
M ckan/logic/schema.py
M ckanext/test_tag_vocab_plugin.py
Log Message:
-----------
[#649] Rename db_to_form_package_schema() -> default_show_package_schema()
This makes the name consistent with default_create_package_schema() and
default_update_package_schema().
Commit: d7cf2bd4e53034a37ac2f884f0320523eadfa8ff
https://github.com/okfn/ckan/commit/d7cf2bd4e53034a37ac2f884f0320523eadfa8ff
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2013-03-19 (Tue, 19 Mar 2013)
Changed paths:
M ckan/lib/plugins.py
M ckan/logic/action/get.py
M ckanext/test_tag_vocab_plugin.py
Log Message:
-----------
[#649] Get rid of form_to_db_schema_options()
package_show(): Don't call an IDatasetForm plugin's
db_to_form_schema_options() or db_to_form_schema() anymore, instead call
package_show_schema(), if the plugin doesn't have that method or if it
returns None then fall back on
ckan.logic.schema.default_package_show_schema(). (Same pattern as for
package_create() and package_update()).
Delete DefaultDatasetForm's db_to_form_schema_options() and
db_to_form_schema(), add show_package_schema() that just returns None,
same as create_package_schema() and update_package_schema().
Commit: 78ce503ae6ded1e406689aa26d01179b65d74863
https://github.com/okfn/ckan/commit/78ce503ae6ded1e406689aa26d01179b65d74863
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2013-03-19 (Tue, 19 Mar 2013)
Changed paths:
M ckan/controllers/package.py
Log Message:
-----------
Remove unused _check_data_dict() from package controller
This method is never called
Commit: 24a616fff72a053ee093f6ebdcfa23e61177468d
https://github.com/okfn/ckan/commit/24a616fff72a053ee093f6ebdcfa23e61177468d
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2013-03-19 (Tue, 19 Mar 2013)
Changed paths:
M ckan/controllers/package.py
Log Message:
-----------
[#649] Remove schema-related hacks from package controller
These hacks are no longer needed
Commit: cc4c9093526fea25ad4340b1530ef8f26dd7a9e6
https://github.com/okfn/ckan/commit/cc4c9093526fea25ad4340b1530ef8f26dd7a9e6
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2013-03-19 (Tue, 19 Mar 2013)
Changed paths:
M ckan/controllers/group.py
M ckan/controllers/package.py
M ckan/lib/app_globals.py
M ckan/lib/dictization/model_dictize.py
M ckan/lib/plugins.py
M ckan/lib/search/index.py
M ckan/logic/action/create.py
M ckan/logic/action/get.py
M ckan/logic/action/update.py
M ckan/new_authz.py
M ckan/plugins/interfaces.py
M ckan/plugins/toolkit.py
M ckan/public/base/less/module.less
M ckan/templates/organization/bulk_process.html
M ckan/templates/organization/members.html
M ckan/templates/package/snippets/package_metadata_fields.html
M ckan/tests/functional/test_package.py
A ckanext/example_idatasetform/__init__.py
A ckanext/example_idatasetform/plugin.py
A ckanext/example_idatasetform/templates/package/read.html
A ckanext/example_idatasetform/templates/package/snippets/package_metadata_fields.html
M doc/conf.py
R doc/forms.rst
M doc/index.rst
M doc/tag-vocabularies.rst
M setup.py
Log Message:
-----------
Merge branch 'master' of github.com:okfn/ckan into idatasetform-package-schemas-simplification
Conflicts:
ckan/controllers/package.py
ckan/lib/plugins.py
At this point ckanext/example_idatasetform/ is broken by the recent #649
commits, will fix it in following commits...
Commit: 0cfc3a162b1f5e3ea7c6f01281bca5b4d2709b79
https://github.com/okfn/ckan/commit/0cfc3a162b1f5e3ea7c6f01281bca5b4d2709b79
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2013-03-19 (Tue, 19 Mar 2013)
Changed paths:
M ckanext/example_idatasetform/plugin.py
Log Message:
-----------
[#649] Update example_idatasetform to new IDatasetForm interface
This imports ckan.logic.schema which is bad.
Commit: 09583bf1382d181c51786f66a83e2bc06af9588c
https://github.com/okfn/ckan/commit/09583bf1382d181c51786f66a83e2bc06af9588c
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2013-03-19 (Tue, 19 Mar 2013)
Changed paths:
M ckan/lib/plugins.py
M ckan/logic/action/create.py
M ckan/logic/action/get.py
M ckan/logic/action/update.py
M ckanext/example_idatasetform/plugin.py
Log Message:
-----------
[#649] Make DefaultDatasetForm return default schemas
Make DefaultDatasetForm's create_package_schema(),
update_package_schema() and show_package_schema() methods return
default_create_package_schema(), default_update_package_schema() and
default_show_package_schema() from schema.py.
This makes it easier for plugins as they can just inherit from
DefaultDatasetForm and call super() to get the default schemas, they
don't need to import ckan.logic.schema to get them (or we don't need to
add the default schemas to the plugins toolkit).
This removes the logic, which was repeated in package_create(),
package_update() and package_show(), of getting the schema from the
plugin but if the plugin provided no schema then falling back on the default
one from schema.py. The action functions now simply get the schema from
plugin and always expect the plugin to provide the schema. The default
fallback behaviour is provided by plugins inheriting from
DefaultDatasetForm instead.
Commit: a2108e053fa608e0febee8447126b3552882efae
https://github.com/okfn/ckan/commit/a2108e053fa608e0febee8447126b3552882efae
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2013-03-19 (Tue, 19 Mar 2013)
Changed paths:
M ckan/plugins/interfaces.py
Log Message:
-----------
[#649] Update IDatasetForm docs
Compare: https://github.com/okfn/ckan/compare/3efeda6fb0cd...a2108e053fa6
More information about the ckan-changes
mailing list