[ckan-changes] [ckan/ckan] 6f8a0c: [#1894] Fix convert_to_extras to allow use with no...

GitHub noreply at github.com
Wed Sep 10 13:29:16 UTC 2014


  Branch: refs/heads/master
  Home:   https://github.com/ckan/ckan
  Commit: 6f8a0cadd784440c0d1d8b8d76ca5f7e03800260
      https://github.com/ckan/ckan/commit/6f8a0cadd784440c0d1d8b8d76ca5f7e03800260
  Author: amercader <amercadero at gmail.com>
  Date:   2014-08-21 (Thu, 21 Aug 2014)

  Changed paths:
    M ckan/logic/converters.py
    A ckan/new_tests/lib/navl/test_converters.py

  Log Message:
  -----------
  [#1894] Fix convert_to_extras to allow use with normal extras

`convert_to_extras` was adding the custom fields in an unflattened way
during validation to the object that would be later unflattened. This
worked fine if there were only `convert_to_extras` fields, but not if
you were also providing actual extras, eg

    data_dict = {
  'name': 'test-dataset',
  'custom_text': 'Hi',
  'custom_text2': 'Hi2',
  'extras': [
      {'key': 'proper_extra', 'value': 'Bye'},
  ]

    }

This fixes the `convert_to_extras` output and adds new converters test for it.


  Commit: 9762a858ab7c6a82b1e31432df4eb8f1d1a486e3
      https://github.com/ckan/ckan/commit/9762a858ab7c6a82b1e31432df4eb8f1d1a486e3
  Author: amercader <amercadero at gmail.com>
  Date:   2014-08-25 (Mon, 25 Aug 2014)

  Changed paths:
    R ckan/new_tests/lib/navl/test_converters.py
    A ckan/new_tests/logic/test_conversion.py
    M ckan/new_tests/logic/test_converters.py

  Log Message:
  -----------
  [#1894] Move test files to proper place

Moved functional tests to ckan/new_tests/logic/test_conversion.py and
added new unit tests for `convert_to_extras` to
ckan/new_tests/logic/test_converters.py


  Commit: 5161e15c08aae4032a5e596fff5d2deb1adfa703
      https://github.com/ckan/ckan/commit/5161e15c08aae4032a5e596fff5d2deb1adfa703
  Author: amercader <amercadero at gmail.com>
  Date:   2014-08-25 (Mon, 25 Aug 2014)

  Changed paths:
    M ckan/lib/navl/dictization_functions.py
    A ckan/new_tests/lib/navl/test_dictization_functions.py

  Log Message:
  -----------
  [#1894] Pass a list of keys in the schema to validators

This is included in the context. We pass a copy of the one provided to
validate.


  Commit: 8bf7e003a329586203d5628369f7c2371cd5b111
      https://github.com/ckan/ckan/commit/8bf7e003a329586203d5628369f7c2371cd5b111
  Author: amercader <amercadero at gmail.com>
  Date:   2014-08-25 (Mon, 25 Aug 2014)

  Changed paths:
    M ckan/logic/schema.py
    M ckan/logic/validators.py
    M ckan/new_tests/logic/test_conversion.py

  Log Message:
  -----------
  [#1894] Prevent free extras to have the same key as a schema field

Added a new validator to the 'key' field of the extras schema that
checks if the value is present on the 'schema_fields' list that was
added to the context on the previous commit.


  Commit: 500dc59de69206b20376a54bd9deff797b70bcd3
      https://github.com/ckan/ckan/commit/500dc59de69206b20376a54bd9deff797b70bcd3
  Author: amercader <amercadero at gmail.com>
  Date:   2014-08-25 (Mon, 25 Aug 2014)

  Changed paths:
    M ckan/logic/__init__.py

  Log Message:
  -----------
  [#1894] (Partially) Fix the error_summary for extras validation errors

If there is a validation error on the extras, the error summary would
*always* be `Missing Value`. I guess it was assumed that all validation
errors would be that the extra key was missing. The fix is not ideal, as
it still assumes that all errors will be on the 'key' field (there could
be custom validation on the value), but at least it will show more than
one error, and the ones different from `Missing Value`.

This can furhter be improved, eg changing the macro that renders the
error summary on the templates to allow lists of errors, and maybe
showing the error below the actual extra field (using the index?)


  Commit: 3158a75f547dc0e7a7b39fb95abc9d87d66ca4f5
      https://github.com/ckan/ckan/commit/3158a75f547dc0e7a7b39fb95abc9d87d66ca4f5
  Author: amercader <amercadero at gmail.com>
  Date:   2014-08-25 (Mon, 25 Aug 2014)

  Changed paths:
    M ckanext/example_idatasetform/templates/package/snippets/package_metadata_fields.html
    M doc/extensions/adding-custom-fields.rst

  Log Message:
  -----------
  [#1894] Update docs and example_idatasetform to reflect changes

I kept the example of removing the default key/value extras, as this is
what most people would want to do anyway, but mentioning that you have
the option of combining them both on CKAN >= 2.2.1


  Commit: 80c8c4452d8bb6858ad844a7e8798e133b305d0f
      https://github.com/ckan/ckan/commit/80c8c4452d8bb6858ad844a7e8798e133b305d0f
  Author: amercader <amercadero at gmail.com>
  Date:   2014-08-26 (Tue, 26 Aug 2014)

  Changed paths:
    M ckan/new_tests/logic/test_conversion.py

  Log Message:
  -----------
  [#1894] Simplify conversion tests

Don't load `example_idatasetform` as this causes failures in other
tests. Rather pass a schema directly.


  Commit: 19565de81e70173270052c1e34e89ed5dd76b5c2
      https://github.com/ckan/ckan/commit/19565de81e70173270052c1e34e89ed5dd76b5c2
  Author: joetsoi <joe.yeung.tsoi at gmail.com>
  Date:   2014-09-10 (Wed, 10 Sep 2014)

  Changed paths:
    M ckan/lib/navl/dictization_functions.py
    M ckan/logic/__init__.py
    M ckan/logic/converters.py
    M ckan/logic/schema.py
    M ckan/logic/validators.py
    A ckan/new_tests/lib/navl/test_dictization_functions.py
    A ckan/new_tests/logic/test_conversion.py
    M ckan/new_tests/logic/test_converters.py
    M ckanext/example_idatasetform/templates/package/snippets/package_metadata_fields.html
    M doc/extensions/adding-custom-fields.rst

  Log Message:
  -----------
  Merge branch '1894-use-extras-and-convert_to_extras'


Compare: https://github.com/ckan/ckan/compare/6d13801bc923...19565de81e70


More information about the ckan-changes mailing list