[ckan-changes] [ckan/ckan] 227dbc: Extend Flask template dirs

GitHub noreply at github.com
Wed Oct 11 19:45:16 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/ckan/ckan
  Commit: 227dbcf3c48fcc4c07efe7bbcf40f626632d0162
      https://github.com/ckan/ckan/commit/227dbcf3c48fcc4c07efe7bbcf40f626632d0162
  Author: Sergey Motornyuk <sergey.motornyuk at linkdigital.com.au>
  Date:   2017-10-09 (Mon, 09 Oct 2017)

  Changed paths:
    M ckan/config/environment.py
    M ckan/config/middleware/flask_app.py
    M ckan/lib/render.py
    M ckan/views/api.py

  Log Message:
  -----------
  Extend Flask template dirs

Add additional template directories to template_loader during
creation of Flask app stack. Previously we put list of additional
dirs into `config['pylons.app_globals'].template_paths`, but
as we are migrating to Flask I moved this value to
`config['computed_template_paths']`. After this, inside
`make_flask_app`, default `jinja_loader` replaced with ChoiceLoader,
that will try to load templates from either default dirs or custom
ones.


  Commit: e860da3c16ae3c1252a18b76528beea8b1350ed8
      https://github.com/ckan/ckan/commit/e860da3c16ae3c1252a18b76528beea8b1350ed8
  Author: Sergey Motornyuk <sergey.motornyuk at linkdigital.com.au>
  Date:   2017-10-09 (Mon, 09 Oct 2017)

  Changed paths:
    M ckan/config/middleware/flask_app.py
    M ckan/lib/render.py
    M ckan/tests/controllers/test_api.py

  Log Message:
  -----------
  Extended FileSystemLoader

Generally, previous solution works, but template_loader created
only once and not updated during dynamic plugin loading.
New `CkanextTemplateLoader` inherits from `FileSystemLoader` but
does not save path to template dir inside own property. Instead,
property getter returns current state of config variable that
contains template paths.


  Commit: bfcbadeecc7d59c329083a016be55e86f3f90251
      https://github.com/ckan/ckan/commit/bfcbadeecc7d59c329083a016be55e86f3f90251
  Author: Sergey Motornyuk <sergey.motornyuk at linkdigital.com.au>
  Date:   2017-10-11 (Wed, 11 Oct 2017)

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

  Log Message:
  -----------
  Always use ChoiceLoader


  Commit: f1f36f8a67b1e247005bb7cb9911b42ff8227af8
      https://github.com/ckan/ckan/commit/f1f36f8a67b1e247005bb7cb9911b42ff8227af8
  Author: Adrià Mercader <amercadero at gmail.com>
  Date:   2017-10-11 (Wed, 11 Oct 2017)

  Changed paths:
    M ckan/config/environment.py
    M ckan/config/middleware/flask_app.py
    M ckan/lib/render.py
    M ckan/tests/controllers/test_api.py
    M ckan/views/api.py

  Log Message:
  -----------
  Merge pull request #3860 from smotornyuk/3833-customize-flask-template-dirs

[#3833] Extend Flask template dirs


Compare: https://github.com/ckan/ckan/compare/c1d98452a718...f1f36f8a67b1


More information about the ckan-changes mailing list