[ckan-changes] [okfn/ckan] ecf4ec: [#2815] Fix tracking info and isopen being strippe...

GitHub noreply at github.com
Wed Aug 8 18:17:33 UTC 2012


  Branch: refs/heads/2815-defect-db-to-form-package-schema-strips-tracking-summary-and-is-open
  Home:   https://github.com/okfn/ckan
  Commit: ecf4ec64f0861d785ed19778348978073bc4e16c
      https://github.com/okfn/ckan/commit/ecf4ec64f0861d785ed19778348978073bc4e16c
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-08-08 (Wed, 08 Aug 2012)

  Changed paths:
    M ckan/lib/dictization/model_dictize.py
    M ckan/lib/plugins.py
    M ckan/logic/schema.py
    M ckan/model/package.py
    M ckan/tests/lib/test_dictization.py
    M ckan/tests/lib/test_dictization_schema.py

  Log Message:
  -----------
  [#2815] Fix tracking info and isopen being stripped by validate

The 'tracking_summary' and 'isopen' fields were being stripped from
package dicts by validation. Only happened when there was a schema in use
that packages dict were being validated against, e.g. when there was an
IDatasetForm plugin with a db_to_form_schema() method.

When dictizing packages, 'tracking_summary' was being added to package
dicts as a sub-dict with two keys 'total' and 'recent', but
ckan/lib/navl/dictization_functions.py:validate() does not allow package
dicts to contain sub-dicts ("Only lists of dicts can be placed against
subschema"), they can contain only single values (e.g. strings, numbers,
bools) or lists of dicts (e.g. list of tag dicts) but not single dicts.
So change the dictization of packages to add two keys
'tracking_summary_total' and 'tracking_summary_recent' instead.

Add 'tracking_summary_total', 'tracking_summary_recent' and 'isopen' to
default_package_schema() so that they do not get stripped from package
dicts during validation.

Update a few tests now that package dicts have these three new keys.





More information about the ckan-changes mailing list