[ckan-changes] [ckan/ckan] 126f86: [#4801] Add routes.named_routes config option

Adrià Mercader noreply at github.com
Fri Dec 6 15:23:45 UTC 2019


  Branch: refs/heads/py3-general-support-2
  Home:   https://github.com/ckan/ckan
  Commit: 126f862293ab145f516bcd4e3d85f613278c7eed
      https://github.com/ckan/ckan/commit/126f862293ab145f516bcd4e3d85f613278c7eed
  Author: amercader <amercadero at gmail.com>
  Date:   2019-12-06 (Fri, 06 Dec 2019)

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

  Log Message:
  -----------
  [#4801] Add routes.named_routes config option


  Commit: 92326d1b357e128bdd08bcb26a1eda255675830c
      https://github.com/ckan/ckan/commit/92326d1b357e128bdd08bcb26a1eda255675830c
  Author: amercader <amercadero at gmail.com>
  Date:   2019-12-06 (Fri, 06 Dec 2019)

  Changed paths:
    M ckan/lib/repoze_plugins/friendly_form.py

  Log Message:
  -----------
  [#4801] Handle webob py2/3 differences in friendly form


  Commit: 15440ebba7ed96ed1e9e93c93a6216e0a643395b
      https://github.com/ckan/ckan/commit/15440ebba7ed96ed1e9e93c93a6216e0a643395b
  Author: amercader <amercadero at gmail.com>
  Date:   2019-12-06 (Fri, 06 Dec 2019)

  Changed paths:
    M ckan/lib/navl/dictization_functions.py

  Log Message:
  -----------
  [#4801] Don't modify dict while in loop


  Commit: 3f44157c7efdb73ff1f5356224e02eb9988091f6
      https://github.com/ckan/ckan/commit/3f44157c7efdb73ff1f5356224e02eb9988091f6
  Author: amercader <amercadero at gmail.com>
  Date:   2019-12-06 (Fri, 06 Dec 2019)

  Changed paths:
    M ckan/model/license.py

  Log Message:
  -----------
  [#4801] Don't decode to unicode on py3, mark regexp in license model


  Commit: 621b008c9b2e7e07aef7410f85a61fec94154df0
      https://github.com/ckan/ckan/commit/621b008c9b2e7e07aef7410f85a61fec94154df0
  Author: amercader <amercadero at gmail.com>
  Date:   2019-12-06 (Fri, 06 Dec 2019)

  Changed paths:
    M ckan/lib/jinja_extensions.py

  Log Message:
  -----------
  [#4801] Use buitin next() function rather than the method


  Commit: 976b7072280a694e59de35f9095b9985bef882bc
      https://github.com/ckan/ckan/commit/976b7072280a694e59de35f9095b9985bef882bc
  Author: amercader <amercadero at gmail.com>
  Date:   2019-12-06 (Fri, 06 Dec 2019)

  Changed paths:
    M ckan/lib/helpers.py

  Log Message:
  -----------
  [#4801] No paster cli in py3


  Commit: b678bdc6b5c8327ae504ffdc58927d43833be46b
      https://github.com/ckan/ckan/commit/b678bdc6b5c8327ae504ffdc58927d43833be46b
  Author: amercader <amercadero at gmail.com>
  Date:   2019-12-06 (Fri, 06 Dec 2019)

  Changed paths:
    M ckan/lib/webassets_tools.py

  Log Message:
  -----------
  [#4801] Webassets requires a proper boolean for debug in py3


  Commit: 7da99d248b8e5760ffbb9cb68d984a786b7b0a83
      https://github.com/ckan/ckan/commit/7da99d248b8e5760ffbb9cb68d984a786b7b0a83
  Author: amercader <amercadero at gmail.com>
  Date:   2019-12-06 (Fri, 06 Dec 2019)

  Changed paths:
    M ckan/lib/helpers.py

  Log Message:
  -----------
  [#4801] Handle local URLs in url_for

In some cases we call `helpers.url_for()` with an actual URL path rather
than an endpoint name or controller/action kwargs. The main use case for
this is building static URLs that take into account the root path, etc

    h.url_for('/base/css/main.css')

The Pylons router (`routes`) was find with this, but the Flask one will
fail because it requires the first arg to be an actual `endpoint` name
like `dataset.new`. Up until now the Flask router was failing and the
url was then picked up by the fallback Pylons one, which returned the
expected URL.

On python 3 Pylons and its router is gone, so the generation of these
URLs (eg during the initialization of webassets) raises a
`FlaskRouteBuildError` exception.

This commit adds the routes behaviour to our wrapper if the Flask router
fails and the URL starts with `/`. The URL will get prepended with
`environ['SCRIPT_NAME']` if present, and any keyword args will be added
as query string (which is unlikely that will get used but will preserve
the current behaviour)


Compare: https://github.com/ckan/ckan/compare/99fcae46c524...7da99d248b8e


More information about the ckan-changes mailing list