[ckan-changes] [ckan/ckan] c087a7: [#3196] Remove usages of g outside templates

GitHub noreply at github.com
Fri Aug 12 10:18:05 UTC 2016


  Branch: refs/heads/3196-common-context
  Home:   https://github.com/ckan/ckan
  Commit: c087a72d77daf0f5c7068477231c649af8eecce9
      https://github.com/ckan/ckan/commit/c087a72d77daf0f5c7068477231c649af8eecce9
  Author: amercader <amercadero at gmail.com>
  Date:   2016-08-11 (Thu, 11 Aug 2016)

  Changed paths:
    M ckan/controllers/feed.py
    M ckan/controllers/group.py
    M ckan/controllers/home.py
    M ckan/controllers/package.py
    M ckan/controllers/user.py
    M ckan/lib/base.py
    M ckan/lib/helpers.py

  Log Message:
  -----------
  [#3196] Remove usages of g outside templates


  Commit: eab36be298ddb1ae39347468fbe13bad9c3b086b
      https://github.com/ckan/ckan/commit/eab36be298ddb1ae39347468fbe13bad9c3b086b
  Author: amercader <amercadero at gmail.com>
  Date:   2016-08-11 (Thu, 11 Aug 2016)

  Changed paths:
    M ckan/common.py

  Log Message:
  -----------
  [#3196] Replace Pylons' g and c with a proxy

To either Flask's `g` or Pylons `c` depending on who serves the request.

Pylons' `g` is no longer used.


  Commit: 4112496f601ec2331a2bf414617341639ff06145
      https://github.com/ckan/ckan/commit/4112496f601ec2331a2bf414617341639ff06145
  Author: amercader <amercadero at gmail.com>
  Date:   2016-08-11 (Thu, 11 Aug 2016)

  Changed paths:
    M ckan/controllers/error.py
    M ckan/lib/maintain.py
    M ckan/lib/plugins.py
    M ckanext/test_tag_vocab_plugin.py

  Log Message:
  -----------
  [#3196] Remove direct c imports from Pylons


  Commit: bfb1ca715c99b3f7bded9d90402fe511c00ae76f
      https://github.com/ckan/ckan/commit/bfb1ca715c99b3f7bded9d90402fe511c00ae76f
  Author: amercader <amercadero at gmail.com>
  Date:   2016-08-11 (Thu, 11 Aug 2016)

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

  Log Message:
  -----------
  [#3196] Fall back to app_globals on Flask g

If a property is not found on `g`, check CKAN's own `app_globals`,
where stuff like `g.site_title` is kept.

The default behaviour for Flask's `g` is to raise an AttributeError if
a missing property is accessed. We have kept this behaviour here and
handled a couple of cases where `c` was accessed outside of a request.
This can be reverted to returning an empty string if necessary.


  Commit: 9f1d70b3068bd7401b4d4e48b66ccf496f11c5b1
      https://github.com/ckan/ckan/commit/9f1d70b3068bd7401b4d4e48b66ccf496f11c5b1
  Author: amercader <amercadero at gmail.com>
  Date:   2016-08-11 (Thu, 11 Aug 2016)

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

  Log Message:
  -----------
  [#3196] Expose `c` as an alias of `g` in templates

In templates rendered by Flask, for backwards compatibility


  Commit: c5cbcca7d90b8697f468b71b191e0167a9343dd7
      https://github.com/ckan/ckan/commit/c5cbcca7d90b8697f468b71b191e0167a9343dd7
  Author: amercader <amercadero at gmail.com>
  Date:   2016-08-12 (Fri, 12 Aug 2016)

  Changed paths:
    M ckan/tests/test_common.py

  Log Message:
  -----------
  [#3196] Add some tests for common context object


  Commit: 7b0cbd6a9979ed91d935f0dc8748ef1974f5505f
      https://github.com/ckan/ckan/commit/7b0cbd6a9979ed91d935f0dc8748ef1974f5505f
  Author: amercader <amercadero at gmail.com>
  Date:   2016-08-12 (Fri, 12 Aug 2016)

  Changed paths:
    M ckan/controllers/group.py
    M ckan/controllers/home.py
    M ckan/controllers/package.py
    M ckan/lib/base.py
    M ckan/lib/maintain.py
    M ckan/lib/plugins.py

  Log Message:
  -----------
  [#3196] Remove context related functions from maintain module

`deprecate_context_item` was a bit of a hack, messing with the
underlying object internal methods and hasn't really been used in ages.
It was hard to make work with the current common context object, so it
makes sense to get rid of it.

`defer_context_item` wasn't used anywhere


Compare: https://github.com/ckan/ckan/compare/c087a72d77da^...7b0cbd6a9979


More information about the ckan-changes mailing list