[ckan-changes] [ckan/ckan] 068b2f: [2158] Added tests to show the issue.

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


  Branch: refs/heads/release-v2.3
  Home:   https://github.com/ckan/ckan
  Commit: 068b2f8f09598053468fea248f4306af6f89f2e0
      https://github.com/ckan/ckan/commit/068b2f8f09598053468fea248f4306af6f89f2e0
  Author: David Read <david.read at hackneyworkshop.com>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M ckan/new_tests/logic/action/test_update.py
    M ckan/new_tests/model/test_resource.py

  Log Message:
  -----------
  [2158] Added tests to show the issue.

Conflicts:
	ckan/new_tests/logic/action/test_update.py


  Commit: 627da069cde0da948b5536d5cd0fd3f4294fa366
      https://github.com/ckan/ckan/commit/627da069cde0da948b5536d5cd0fd3f4294fa366
  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


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

  Changed paths:
    M ckan/new_tests/logic/action/test_update.py

  Log Message:
  -----------
  [#2158] Add more tests


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

  Changed paths:
    M ckan/new_tests/model/test_resource.py

  Log Message:
  -----------
  [#2158] Remove print


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

  Changed paths:
    M ckan/new_tests/model/test_resource.py

  Log Message:
  -----------
  [#2158] Fix model test

We need to assign a new extras dict so the change is detected


Compare: https://github.com/ckan/ckan/compare/ff2753a105db...fd61c8331de8


More information about the ckan-changes mailing list