[ckan-changes] [ckan/ckan] 14f978: [#2158] Replace all resource extras on update so t...

GitHub noreply at github.com
Wed Feb 18 15:12:41 UTC 2015


  Branch: refs/heads/release-v2.2.2
  Home:   https://github.com/ckan/ckan
  Commit: 14f9785d14d98f2b0639a54a81db775737d352ff
      https://github.com/ckan/ckan/commit/14f9785d14d98f2b0639a54a81db775737d352ff
  Author: amercader <amercadero at gmail.com>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M ckan/lib/dictization/model_save.py

  Log Message:
  -----------
  [#2158] Replace all resource extras on update so they don't get lost

Resource `extras` were being ignored on `resource_udpate`. The rest of
the resource field got updated but no the extras.

The resource `extras` field is using a custom `JsonDictType`, and
according to SQLAlchemy documentation:

> Note that the ORM by default will not detect “mutability” on such a
> type - meaning, in-place changes to values will not be detected and
> will not be flushed. Without further steps, you instead would need to
> replace the existing value with a new one on each parent object to
> detect changes.

Replacing `obj.extras` with a new dict solves the issue

http://docs.sqlalchemy.org/en/rel_0_9/core/custom_types.html#marshal-json-strings

Conflicts:
	ckan/lib/dictization/model_save.py


  Commit: fa7c791b179043b400a59cee7e55119c5e5c82ac
      https://github.com/ckan/ckan/commit/fa7c791b179043b400a59cee7e55119c5e5c82ac
  Author: amercader <amercadero at gmail.com>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M MANIFEST.in

  Log Message:
  -----------
  [#2283] Pack template_legacy resources on python setup.py install

Original patch by @Jan-Marcek


Compare: https://github.com/ckan/ckan/compare/7e278dc278be...fa7c791b1790


More information about the ckan-changes mailing list