[ckan-changes] [ckan/ckan] 86ec83: [#1776] Fix bug when upserting [] on JSON column i...

GitHub noreply at github.com
Fri Aug 1 15:55:13 UTC 2014


  Branch: refs/heads/release-v2.0.5
  Home:   https://github.com/ckan/ckan
  Commit: 86ec831b583b80d9cc31bd3db543899c7d8e0a01
      https://github.com/ckan/ckan/commit/86ec831b583b80d9cc31bd3db543899c7d8e0a01
  Author: Vitor Baptista <vitor at vitorbaptista.com>
  Date:   2014-08-01 (Fri, 01 Aug 2014)

  Changed paths:
    M ckanext/datastore/db.py
    M ckanext/datastore/tests/test_upsert.py

  Log Message:
  -----------
  [#1776] Fix bug when upserting [] on JSON column in the datastore

We were testing that the new value wasn't `None` using `if value`. As `[]` is a
falsy value, we never went through that `if` and ended up trying to run an
invalid SQL query.

This commit fixes that by explictly testing `if value is not None`.

This was first discovered in
http://stackoverflow.com/questions/24207065/inserting-empty-arrays-in-json-type-fields-in-datastore




More information about the ckan-changes mailing list