[ckan-changes] [okfn/ckan] ca8753: [#649] Rename default_package_schema() -> _base_pa...

GitHub noreply at github.com
Tue Mar 19 12:35:29 UTC 2013


  Branch: refs/heads/idatasetform-package-schemas-simplification
  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.


Compare: https://github.com/okfn/ckan/compare/ca8753612975^...3c677cfdfcfb


More information about the ckan-changes mailing list