[ckan-changes] [okfn/ckan] 36caaa: Log possible problems with the datastore permissio...

GitHub noreply at github.com
Mon Apr 8 16:25:16 UTC 2013


  Branch: refs/heads/release-v2.0
  Home:   https://github.com/okfn/ckan
  Commit: 36caaa93ea2a3e9bd3f97871bbfd9148f764d25e
      https://github.com/okfn/ckan/commit/36caaa93ea2a3e9bd3f97871bbfd9148f764d25e
  Author: Dominik Moritz <domoritz at gmail.com>
  Date:   2013-04-08 (Mon, 08 Apr 2013)

  Changed paths:
    M ckanext/datastore/plugin.py

  Log Message:
  -----------
  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: efbc5f8cf9c3839291da82914a8fdb39812ca155
      https://github.com/okfn/ckan/commit/efbc5f8cf9c3839291da82914a8fdb39812ca155
  Author: Dominik Moritz <domoritz at gmail.com>
  Date:   2013-04-08 (Mon, 08 Apr 2013)

  Changed paths:
    M ckanext/datastore/plugin.py

  Log Message:
  -----------
  Add spaces to log messages where they are missing


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

  Changed paths:
    M ckanext/datastore/plugin.py

  Log Message:
  -----------
  Use has_table_privilege and has_schema_privilege instead of experimental privilege checks.


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

  Changed paths:
    M ckanext/datastore/plugin.py

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


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

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

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


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

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

  Log Message:
  -----------
  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: 9d6cb1ed5072a8418fd106ff4a0b1be3a835cb9d
      https://github.com/okfn/ckan/commit/9d6cb1ed5072a8418fd106ff4a0b1be3a835cb9d
  Author: Dominik Moritz <domoritz at gmail.com>
  Date:   2013-04-08 (Mon, 08 Apr 2013)

  Changed paths:
    M ckanext/datastore/plugin.py

  Log Message:
  -----------
  Simplify check for debug mode, only create _foo once


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

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

  Log Message:
  -----------
  Refactored datastore config to make it easier to understand and easier to test


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

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

  Log Message:
  -----------
  Ignore permission check in legacy mode and improve configuration tests


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

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

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


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

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

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


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

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

  Log Message:
  -----------
  Use single quotes where possible


  Commit: 9a8249a0113fb3a36ece6bb08e83f011310cb22e
      https://github.com/okfn/ckan/commit/9a8249a0113fb3a36ece6bb08e83f011310cb22e
  Author: Vitor Baptista <vitor at vitorbaptista.com>
  Date:   2013-04-08 (Mon, 08 Apr 2013)

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

  Log Message:
  -----------
  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: bc3534e1b111dd60f8a77693fa3e10f0dd4f6bb4
      https://github.com/okfn/ckan/commit/bc3534e1b111dd60f8a77693fa3e10f0dd4f6bb4
  Author: Dominik Moritz <domoritz at gmail.com>
  Date:   2013-04-08 (Mon, 08 Apr 2013)

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

  Log Message:
  -----------
  PEP8


Compare: https://github.com/okfn/ckan/compare/18d5859537c7...bc3534e1b111


More information about the ckan-changes mailing list