[ckan-changes] [okfn/ckan] 46e3fd: [#642] Log possible problems with the datastore pe...

GitHub noreply at github.com
Tue Apr 2 22:17:38 UTC 2013


  Branch: refs/heads/master
  Home:   https://github.com/okfn/ckan
  Commit: 46e3fde42fa36efdfc08dc2162c001cc5f4f67c5
      https://github.com/okfn/ckan/commit/46e3fde42fa36efdfc08dc2162c001cc5f4f67c5
  Author: Dominik Moritz <domoritz at gmail.com>
  Date:   2013-03-25 (Mon, 25 Mar 2013)

  Changed paths:
    M ckanext/datastore/plugin.py

  Log Message:
  -----------
  [#642] Log possible problems with the datastore permission checks instead of raising an exception.
If postgres is set to a language other than english, some strings might not occur in the error message returned from the database. This change makes the checks less strict but in almost all cases, this should not be a problem because the only error raised during executing of the permission check statements are (expected) permission errors.


  Commit: 8d3917112382474d2d44900f979fee6ba99b7af7
      https://github.com/okfn/ckan/commit/8d3917112382474d2d44900f979fee6ba99b7af7
  Author: Dominik Moritz <domoritz at gmail.com>
  Date:   2013-03-26 (Tue, 26 Mar 2013)

  Changed paths:
    M ckanext/datastore/plugin.py

  Log Message:
  -----------
  [#642] Add spaces to log messages where they are missing


  Commit: b68601d2bae05f289e969f189a0495ab9d53283e
      https://github.com/okfn/ckan/commit/b68601d2bae05f289e969f189a0495ab9d53283e
  Author: Dominik Moritz <domoritz at gmail.com>
  Date:   2013-03-27 (Wed, 27 Mar 2013)

  Changed paths:
    M ckanext/datastore/plugin.py

  Log Message:
  -----------
  [#642] Use has_table_privilege and has_schema_privilege instead of experimental privilege checks.


  Commit: cbc4fa95731b018d9d36a860662d5b6e9f8e43a1
      https://github.com/okfn/ckan/commit/cbc4fa95731b018d9d36a860662d5b6e9f8e43a1
  Author: Dominik Moritz <domoritz at gmail.com>
  Date:   2013-03-27 (Wed, 27 Mar 2013)

  Changed paths:
    M ckanext/datastore/plugin.py

  Log Message:
  -----------
  [#642] Make check functions consistent (return bool instead of raising exceptions)


  Commit: 302a9ff87780ce6653f16fd77bf25496b586a9e2
      https://github.com/okfn/ckan/commit/302a9ff87780ce6653f16fd77bf25496b586a9e2
  Author: Dominik Moritz <domoritz at gmail.com>
  Date:   2013-03-27 (Wed, 27 Mar 2013)

  Changed paths:
    M ckanext/datastore/plugin.py
    M ckanext/datastore/tests/test_configure.py

  Log Message:
  -----------
  [#642] Refactor datastore plugin configuration, improve (and fix ;-)) tests


  Commit: b2f477f9fe73e07820330a71460a65015332e2f0
      https://github.com/okfn/ckan/commit/b2f477f9fe73e07820330a71460a65015332e2f0
  Author: Dominik Moritz <domoritz at gmail.com>
  Date:   2013-03-28 (Thu, 28 Mar 2013)

  Changed paths:
    M ckanext/datastore/plugin.py
    M ckanext/datastore/tests/test_configure.py

  Log Message:
  -----------
  [#642] Fix how the check for separate urls is ignored in legacy mode.
I put the check for the legacy mode in this function to make it testable.


  Commit: 1a9566bc9ce4b4c5e1ac9dfe36e22f296bc7c5f3
      https://github.com/okfn/ckan/commit/1a9566bc9ce4b4c5e1ac9dfe36e22f296bc7c5f3
  Author: Dominik Moritz <domoritz at gmail.com>
  Date:   2013-03-28 (Thu, 28 Mar 2013)

  Changed paths:
    M ckanext/datastore/plugin.py

  Log Message:
  -----------
  [#642] Simplify check for debug mode, only create _foo once


  Commit: c82ba857ba6f3073948a101a1e16a5bf59548abd
      https://github.com/okfn/ckan/commit/c82ba857ba6f3073948a101a1e16a5bf59548abd
  Author: Dominik Moritz <domoritz at gmail.com>
  Date:   2013-03-28 (Thu, 28 Mar 2013)

  Changed paths:
    M ckanext/datastore/plugin.py
    M ckanext/datastore/tests/test_configure.py

  Log Message:
  -----------
  [#642] Refactored datastore config to make it easier to understand and easier to test


  Commit: 0f8c1965f8507bb27826edee90e6ba72b2cb6191
      https://github.com/okfn/ckan/commit/0f8c1965f8507bb27826edee90e6ba72b2cb6191
  Author: Dominik Moritz <domoritz at gmail.com>
  Date:   2013-03-29 (Fri, 29 Mar 2013)

  Changed paths:
    M ckanext/datastore/plugin.py
    M ckanext/datastore/tests/test_configure.py

  Log Message:
  -----------
  [#642] Ignore permission check in legacy mode and improve configuration tests


  Commit: bb2ca7f58005142b7008132692b9cdc954045b02
      https://github.com/okfn/ckan/commit/bb2ca7f58005142b7008132692b9cdc954045b02
  Author: Dominik Moritz <domoritz at gmail.com>
  Date:   2013-04-01 (Mon, 01 Apr 2013)

  Changed paths:
    M ckanext/datastore/plugin.py
    M ckanext/datastore/tests/test_configure.py

  Log Message:
  -----------
  [#642] Inject `error_handler` instead of explicitly passing it as an argument, split large test into smaller tests


  Commit: ad4bb46df8a2913b0bb487dba8ff2468c977e1b6
      https://github.com/okfn/ckan/commit/ad4bb46df8a2913b0bb487dba8ff2468c977e1b6
  Author: Dominik Moritz <domoritz at gmail.com>
  Date:   2013-04-01 (Mon, 01 Apr 2013)

  Changed paths:
    M ckanext/datastore/tests/test_configure.py

  Log Message:
  -----------
  [#642] Add plugin loading and unloading. This does not fix the singleton issue but is better anyway.


  Commit: 66c450a6d655c52e679e3de9a25d36a810bc73da
      https://github.com/okfn/ckan/commit/66c450a6d655c52e679e3de9a25d36a810bc73da
  Author: Dominik Moritz <domoritz at gmail.com>
  Date:   2013-04-02 (Tue, 02 Apr 2013)

  Changed paths:
    M ckanext/datastore/db.py
    M ckanext/datastore/plugin.py

  Log Message:
  -----------
  [#642] Use single quotes where possible


  Commit: a64916ce12ceb88fa5da1e8fe15b02f2848519dd
      https://github.com/okfn/ckan/commit/a64916ce12ceb88fa5da1e8fe15b02f2848519dd
  Author: Vitor Baptista <vitor at vitorbaptista.com>
  Date:   2013-04-02 (Tue, 02 Apr 2013)

  Changed paths:
    M ckanext/datastore/tests/test_configure.py

  Log Message:
  -----------
  [#642] Refactor and fix Datastore tests

Datastore is a SingletonPlugin, so it doesn't matter if we call
plugin.DatastorePlugin() many times: we always end up with the same instance.
I've added a workaround that, first, saves and unloads the current datastore
instance, then sets:

  pyutilib.component.core.PluginGlobals.singleton_services()[plugin.DatastorePlugin] = True

This will make plugin.DatastorePlugin not be a Singleton anymore, so any
subsequent calls to ckan.plugins.load('datastore') will create a new instance.
Then, in the next line, we create a new DatastorePlugin instance by loading
it, and save it into self.p and
pyutilib.component.core.PluginGlobals.singleton_services()[plugin.DatastorePlugin].
This turns DatastorePlugin into a Singleton again, and subsequent calls to
ckan.plugins.load('datastore') will return this new instance instead.

Then, in the teardown, we unload the current the datastore, which gets rid of
our test instance, and put the original datastore back in its place, so the
environment before setUp() is the same as after tearDown().

For InvalidUrlsOrPermissionsException, what I wanted was a way to check if
_check_urls_and_permissions() failed. I did this by overloading _log_or_raise()
with an unique Exception, and checking if it's raised. If so, I guarantee that
_log_or_raise() was called. This feels like too much boilerplate, but we don't
have a stub/mock library, so we have to write it.

Conflicts:
	ckanext/datastore/tests/test_configure.py


  Commit: 511f6f4ff504f67758f67da4340f6544a93dd128
      https://github.com/okfn/ckan/commit/511f6f4ff504f67758f67da4340f6544a93dd128
  Author: Dominik Moritz <domoritz at gmail.com>
  Date:   2013-04-02 (Tue, 02 Apr 2013)

  Changed paths:
    M ckanext/datastore/tests/test_configure.py

  Log Message:
  -----------
  [#642] PEP8


  Commit: f6459ca330fa5c9d3aff1488a9a0fc5327cf47d1
      https://github.com/okfn/ckan/commit/f6459ca330fa5c9d3aff1488a9a0fc5327cf47d1
  Author: Vitor Baptista <vitor at vitorbaptista.com>
  Date:   2013-04-02 (Tue, 02 Apr 2013)

  Changed paths:
    M ckanext/datastore/db.py
    M ckanext/datastore/plugin.py
    M ckanext/datastore/tests/test_configure.py

  Log Message:
  -----------
  Merge pull request #642 from okfn/642-localization-independent-datastore-permission-ckecks

datastore plugin's permission checks will fail on a non english environnement


Compare: https://github.com/okfn/ckan/compare/141d08ca583b...f6459ca330fa


More information about the ckan-changes mailing list