[ckan-changes] [ckan/ckan] 048632: [#2842] Refactor evironment loading, initialize Fl...

GitHub noreply at github.com
Wed Jul 13 13:10:59 UTC 2016


  Branch: refs/heads/2842-common-config
  Home:   https://github.com/ckan/ckan
  Commit: 048632d73588ed462a1133e796681056fe89ef37
      https://github.com/ckan/ckan/commit/048632d73588ed462a1133e796681056fe89ef37
  Author: amercader <amercadero at gmail.com>
  Date:   2016-07-13 (Wed, 13 Jul 2016)

  Changed paths:
    M ckan/config/environment.py
    M ckan/config/middleware/__init__.py
    M ckan/config/middleware/flask_app.py
    M ckan/config/middleware/pylons_app.py
    M ckan/lib/app_globals.py
    M ckan/plugins/core.py
    M ckan/tests/legacy/test_plugins.py

  Log Message:
  -----------
  [#2842] Refactor evironment loading, initialize Flask configuration

Call `load_environment` before making both stacks rather than from the
Pylons one. Call the app_globals code on the common environment code,
not just on the Pylons stack.

Update the Flask config object with all the CKAN values.

Don't pass explicitly the configuration object to the `load_all` plugins
function, use the one in common.


  Commit: 4c377288a1a81b99a56f917d8b9e9a6ca8cdcd4f
      https://github.com/ckan/ckan/commit/4c377288a1a81b99a56f917d8b9e9a6ca8cdcd4f
  Author: amercader <amercadero at gmail.com>
  Date:   2016-07-13 (Wed, 13 Jul 2016)

  Changed paths:
    M ckan/config/middleware/__init__.py
    M ckan/config/middleware/flask_app.py

  Log Message:
  -----------
  [#2842] Wrap Pylons requests in a Flask application context

On this particular branch this is needed so the common CKAN config
object can forward config options to the Flask app config object, but
this will be required anyway as more Flask features need to be available
during a Pylons request (see 62f55d2c96).


  Commit: ad46dce51cd570c814355c833efffb5d7e72cf59
      https://github.com/ckan/ckan/commit/ad46dce51cd570c814355c833efffb5d7e72cf59
  Author: amercader <amercadero at gmail.com>
  Date:   2016-07-13 (Wed, 13 Jul 2016)

  Changed paths:
    M ckan/common.py
    M ckan/config/environment.py
    M ckan/config/middleware/__init__.py
    M ckan/config/middleware/flask_app.py
    M ckan/config/middleware/pylons_app.py
    A ckan/tests/test_common.py

  Log Message:
  -----------
  [#2842] New CKAN config object

Rather than rely on the Pylons (or Flask) config object we define our
own in ckan.common. This is a dict-like object (so fully backwards compatible)
that also proxies any changes to the Flask and Pylons configuration objects
(if they are available)

This should be the only configuration object used in all code unless we really
need to access the underlying Flask or Pylons objects for some reason.

The `ckan.common.config` instance is initialized in the `load_environment`
method with the values of the ini file or env vars.

This is actually a proxy to a property from a Werkzeug Local object, meaning
that `config` is thread-local safe, like its Flask and Pylons counterparts.

See http://werkzeug.pocoo.org/docs/0.11/local/

I tried to separate all Pylons specific stuff (things like `pylons.paths`,
`routes.map` etc) to Pylons own config object to keep the main config object
clean but it proved too difficult, not only because we access these keys from
different parts of the code (which can be solved) but also because when
clearing the config (done on the tests) we lose keys that were added on
`load_environment` and we would need to keep track of those.


  Commit: a77ff9c021c80eee949d2ed11cbafd743ee5c04a
      https://github.com/ckan/ckan/commit/a77ff9c021c80eee949d2ed11cbafd743ee5c04a
  Author: amercader <amercadero at gmail.com>
  Date:   2016-07-13 (Wed, 13 Jul 2016)

  Changed paths:
    M ckan/authz.py
    M ckan/ckan_nose_plugin.py
    M ckan/controllers/admin.py
    M ckan/controllers/feed.py
    M ckan/controllers/home.py
    M ckan/controllers/package.py
    M ckan/controllers/tag.py
    M ckan/controllers/user.py
    M ckan/lib/activity_streams_session_extension.py
    M ckan/lib/app_globals.py
    M ckan/lib/auth_tkt.py
    M ckan/lib/base.py
    M ckan/lib/captcha.py
    M ckan/lib/celery_app.py
    M ckan/lib/cli.py
    M ckan/lib/datapreview.py
    M ckan/lib/dictization/__init__.py
    M ckan/lib/dictization/model_dictize.py
    M ckan/lib/email_notifications.py
    M ckan/lib/hash.py
    M ckan/lib/helpers.py
    M ckan/lib/i18n.py
    M ckan/lib/mailer.py
    M ckan/lib/navl/dictization_functions.py
    M ckan/lib/search/__init__.py
    M ckan/lib/search/index.py
    M ckan/lib/search/query.py
    M ckan/lib/uploader.py
    M ckan/logic/action/create.py
    M ckan/logic/action/get.py
    M ckan/logic/action/update.py
    M ckan/migration/versions/081_set_datastore_active.py
    M ckan/model/license.py
    M ckan/model/meta.py
    M ckan/model/package.py
    M ckan/model/resource.py
    M ckan/plugins/interfaces.py
    M ckan/plugins/toolkit.py
    M ckan/tests/config/test_environment.py
    M ckan/tests/controllers/test_admin.py
    M ckan/tests/helpers.py
    M ckan/tests/legacy/__init__.py
    M ckan/tests/legacy/functional/api/base.py
    M ckan/tests/legacy/functional/api/model/test_package.py
    M ckan/tests/legacy/functional/api/test_activity.py
    M ckan/tests/legacy/functional/api/test_email_notifications.py
    M ckan/tests/legacy/functional/api/test_user.py
    M ckan/tests/legacy/functional/test_activity.py
    M ckan/tests/legacy/functional/test_package.py
    M ckan/tests/legacy/functional/test_user.py
    M ckan/tests/legacy/lib/test_helpers.py
    M ckan/tests/legacy/lib/test_i18n.py
    M ckan/tests/legacy/lib/test_solr_search_index.py
    M ckan/tests/legacy/logic/test_action.py
    M ckan/tests/legacy/logic/test_auth.py
    M ckan/tests/legacy/misc/test_mock_mail_server.py
    M ckan/tests/legacy/misc/test_sync.py
    M ckan/tests/legacy/mock_mail_server.py
    M ckan/tests/legacy/test_plugins.py
    M ckan/tests/lib/search/test_index.py
    M ckan/tests/lib/test_datapreview.py
    M ckan/tests/lib/test_mailer.py
    M ckan/tests/logic/action/test_create.py
    M ckan/tests/logic/action/test_patch.py
    M ckan/tests/logic/action/test_update.py
    M ckan/tests/model/test_license.py
    M ckanext/datapusher/logic/action.py
    M ckanext/datapusher/tests/test.py
    M ckanext/datapusher/tests/test_interfaces.py
    M ckanext/datastore/db.py
    M ckanext/datastore/logic/action.py
    M ckanext/datastore/plugin.py
    M ckanext/datastore/tests/test_create.py
    M ckanext/datastore/tests/test_delete.py
    M ckanext/datastore/tests/test_disable.py
    M ckanext/datastore/tests/test_dump.py
    M ckanext/datastore/tests/test_helpers.py
    M ckanext/datastore/tests/test_search.py
    M ckanext/datastore/tests/test_unit.py
    M ckanext/datastore/tests/test_upsert.py
    M ckanext/example_iauthfunctions/plugin_v5_custom_config_setting.py
    M ckanext/example_iauthfunctions/plugin_v6_parent_auth_functions.py
    M ckanext/example_iauthfunctions/tests/test_example_iauthfunctions.py
    M ckanext/example_iconfigurer/tests/test_iconfigurer_update_config.py
    M ckanext/example_idatasetform/tests/test_example_idatasetform.py
    M ckanext/example_iresourcecontroller/tests/test_example_iresourcecontroller.py
    M ckanext/example_iuploader/test/test_plugin.py
    M ckanext/example_ivalidators/tests/test_ivalidators.py
    M ckanext/multilingual/plugin.py
    M ckanext/reclineview/tests/test_view.py
    M ckanext/resourceproxy/controller.py
    M ckanext/resourceproxy/plugin.py
    M ckanext/resourceproxy/tests/test_proxy.py
    M ckanext/stats/stats.py
    M ckanext/stats/tests/__init__.py
    M ckanext/stats/tests/test_stats_plugin.py
    M ckanext/textview/tests/test_view.py
    M doc/extensions/custom-config-settings.rst

  Log Message:
  -----------
  [#2842] Update all core imports to ckan.common.config


  Commit: 37ecbe8bd44dc0dc03e05d82bf09048c7d1feed6
      https://github.com/ckan/ckan/commit/37ecbe8bd44dc0dc03e05d82bf09048c7d1feed6
  Author: amercader <amercadero at gmail.com>
  Date:   2016-07-13 (Wed, 13 Jul 2016)

  Changed paths:
    M ckan/plugins/toolkit.py

  Log Message:
  -----------
  [#2842] Add config to the plugins toolkit


Compare: https://github.com/ckan/ckan/compare/048632d73588^...37ecbe8bd44d


More information about the ckan-changes mailing list