[ckan-changes] [ckan/ckan] 820bce: [#2845] Routing to a simple Flask app.

GitHub noreply at github.com
Tue Mar 15 09:31:53 UTC 2016


  Branch: refs/heads/master
  Home:   https://github.com/ckan/ckan
  Commit: 820bce55f450cb843c85de812e1884173b34c036
      https://github.com/ckan/ckan/commit/820bce55f450cb843c85de812e1884173b34c036
  Author: Brook Elgie <specialbrew at gmail.com>
  Date:   2016-01-29 (Fri, 29 Jan 2016)

  Changed paths:
    M ckan/config/middleware.py

  Log Message:
  -----------
  [#2845] Routing to a simple Flask app.

Middleware asks the Flask app if it can handle the requested url at
PATH_INFO, dispatching to the app if it can.


  Commit: c2d9b5641bf1d90833f866356b4dbe5ec5d1a904
      https://github.com/ckan/ckan/commit/c2d9b5641bf1d90833f866356b4dbe5ec5d1a904
  Author: Brook Elgie <specialbrew at gmail.com>
  Date:   2016-01-29 (Fri, 29 Jan 2016)

  Changed paths:
    M ckan/config/middleware.py
    M ckan/config/routing.py
    A ckan/controllers/partyline.py

  Log Message:
  -----------
  [#2845] Routing to the Pylons app


  Commit: 3e56b2bc493c3d2abe39b6b6df5a79ef665fe1be
      https://github.com/ckan/ckan/commit/3e56b2bc493c3d2abe39b6b6df5a79ef665fe1be
  Author: Brook Elgie <specialbrew at gmail.com>
  Date:   2016-01-29 (Fri, 29 Jan 2016)

  Changed paths:
    M requirements.in
    M requirements.txt

  Log Message:
  -----------
  [#2845] Update requirements with WSGIParty


  Commit: 33d4204bf26b78da2da9d6c1e3dc28e9888f02df
      https://github.com/ckan/ckan/commit/33d4204bf26b78da2da9d6c1e3dc28e9888f02df
  Author: Brook Elgie <specialbrew at gmail.com>
  Date:   2016-01-29 (Fri, 29 Jan 2016)

  Changed paths:
    M requirements.in
    M requirements.txt

  Log Message:
  -----------
  [#2845] More requirements


  Commit: bf064fd8521c3ffa147be73c373340f03c66d200
      https://github.com/ckan/ckan/commit/bf064fd8521c3ffa147be73c373340f03c66d200
  Author: amercader <amercadero at gmail.com>
  Date:   2016-02-24 (Wed, 24 Feb 2016)

  Changed paths:
    A CONDUCT.rst
    M bin/travis-run-tests
    M ckan/config/environment.py
    M ckan/config/resource_formats.json
    M ckan/controllers/group.py
    M ckan/controllers/package.py
    M ckan/exceptions.py
    M ckan/lib/formatters.py
    M ckan/lib/helpers.py
    M ckan/lib/search/query.py
    M ckan/logic/action/create.py
    M ckan/logic/action/get.py
    M ckan/logic/schema.py
    M ckan/model/resource.py
    A ckan/public/base/images/ckan-logo-white.svg
    A ckan/public/base/images/ckan-logo.svg
    M ckan/templates/snippets/search_form.html
    M ckan/tests/config/test_environment.py
    M ckan/tests/controllers/test_package.py
    M ckan/tests/legacy/lib/test_dictization.py
    M ckan/tests/lib/dictization/test_model_dictize.py
    M ckan/tests/lib/test_helpers.py
    M ckanext/datastore/helpers.py
    M ckanext/datastore/tests/test_helpers.py

  Log Message:
  -----------
  Merge branch 'master' into 2845-wsgi-dispatcher


  Commit: db7970d7189b2bbd64d5bc08c9421322eb5733a4
      https://github.com/ckan/ckan/commit/db7970d7189b2bbd64d5bc08c9421322eb5733a4
  Author: amercader <amercadero at gmail.com>
  Date:   2016-02-24 (Wed, 24 Feb 2016)

  Changed paths:
    M ckan/config/middleware.py

  Log Message:
  -----------
  Fix app lookup

app_name should be the name (ie `pylons_app`) not the actual app

This issue arised because currently the functional tests are broken and
don't call the `can_handle_url` method of the partyline controller. This
means that answers was an empty list and the default option was being
used (crashing because the app lookup failed).

The issue with the functional tests is that when running the tests with
`--with-pylons` option, Pylons will create a WSGI app:

venv/lib/python2.7/site-packages/pylons/test.py:73

Aparently this is to load the configuration. The WSGI Party invites are
sent during the initialization of this first app.

When running a functional test and calling `app = self._get_test_app()`
a new app is created, and invites are sent again. But at this point the
`partyline_connected` attribute has already been set up on the Pylons
globals object, so the URL handler won't be registered.
   if hasattr(g, 'partyline_connected'):
      base.abort(404)

This means that when running the functional tests, only the Flask url
handler is currently called.


  Commit: f35b4ee4f290c647835067abd0b723120317d28d
      https://github.com/ckan/ckan/commit/f35b4ee4f290c647835067abd0b723120317d28d
  Author: amercader <amercadero at gmail.com>
  Date:   2016-02-25 (Thu, 25 Feb 2016)

  Changed paths:
    M requirements.txt

  Log Message:
  -----------
  [#2845] Downgrade simplejson, see #2681


  Commit: ac333805d152572d71ddfe5c97840d4b2ab88a83
      https://github.com/ckan/ckan/commit/ac333805d152572d71ddfe5c97840d4b2ab88a83
  Author: amercader <amercadero at gmail.com>
  Date:   2016-02-26 (Fri, 26 Feb 2016)

  Changed paths:
    M ckan/config/middleware.py
    M ckan/controllers/partyline.py

  Log Message:
  -----------
  [#2845] Hook can_handle_request methods to the actual route maps

Both for the Flask and Pylons apps, match the incoming request against
their own route mappers, and return the tuple (True, app_name) if they
can handle it. AskAppDispatcherMiddleware will ultimately decide who
handles the requests based on these answers.


  Commit: f0b2c87b03793ffbf039ed2574b19500723a956e
      https://github.com/ckan/ckan/commit/f0b2c87b03793ffbf039ed2574b19500723a956e
  Author: amercader <amercadero at gmail.com>
  Date:   2016-02-26 (Fri, 26 Feb 2016)

  Changed paths:
    M ckan/config/middleware.py
    M ckan/config/routing.py
    M ckan/controllers/partyline.py

  Log Message:
  -----------
  [#2485] Enforce order of precedence on request handler middleware

Enforce Flask Extension > Pylons Extension > Flask Core > Pylons Core

Pylons requests are marked core=True or core=False depending on whether
they were set up in core or by an extension. This information is passed
to the handler so it can prioritize which app to use.

TODO: It's still not clear how we will mark Flask routes as core or not,
it will depend on how we end up setting up routing


  Commit: e22d7068abfea60c3f6275c916e8e00d5b65e30a
      https://github.com/ckan/ckan/commit/e22d7068abfea60c3f6275c916e8e00d5b65e30a
  Author: amercader <amercadero at gmail.com>
  Date:   2016-02-29 (Mon, 29 Feb 2016)

  Changed paths:
    M ckan/config/routing.py
    M ckan/controllers/partyline.py

  Log Message:
  -----------
  [#2845] Improve origin detection on Pylons mapper

We can not add custom params to the defaults dict because they get added
to the URL built, eg url_for('group_index') returns `/group?core=True

Ideally we want to keep this flag attached to the actual route, because
it's hard to come up with unique keys for routes which are not named to
keep them on a separate registry. As we can get the actual matched Route
object using `map.routematch` we add a `_ckan_core` attribute to it when
building the mapper.


  Commit: cc943b914136f1d5cfc1bc9ca09d94b74d49ddcf
      https://github.com/ckan/ckan/commit/cc943b914136f1d5cfc1bc9ca09d94b74d49ddcf
  Author: amercader <amercadero at gmail.com>
  Date:   2016-03-10 (Thu, 10 Mar 2016)

  Changed paths:
    M ckan/config/middleware.py

  Log Message:
  -----------
  [#2845] Add the name of the app being used to the WSGI environ


  Commit: 11faea56f052540b4e988e52c8391a59d6cc010f
      https://github.com/ckan/ckan/commit/11faea56f052540b4e988e52c8391a59d6cc010f
  Author: amercader <amercadero at gmail.com>
  Date:   2016-03-10 (Thu, 10 Mar 2016)

  Changed paths:
    M ckan/controllers/partyline.py

  Log Message:
  -----------
  [#2845] Handle case when no route is matched on Pylons

It's not happening now because of the catch-all template route, but
we should be ready for it


  Commit: 7dee663aedb79b075ea5e5ea3bc3b55e13a32c37
      https://github.com/ckan/ckan/commit/7dee663aedb79b075ea5e5ea3bc3b55e13a32c37
  Author: amercader <amercadero at gmail.com>
  Date:   2016-03-10 (Thu, 10 Mar 2016)

  Changed paths:
    M ckan/config/middleware.py
    M ckan/controllers/partyline.py

  Log Message:
  -----------
  [#2845] Don't use the global g object to store party state

Until now we stored `partyline_connected` in the g object to avoid
re-registering. But when more than one application was created (ie
during tests) this meant that the second application didn't get the
partyline handler registered (as `g.partyline_connected` was already
True). Just store it in a per-app (or rather per-controller instance)
basis.

We should probably fix our tests though to use only one app.

Also renamed some vars for consistenct across apps


  Commit: 1ff29e60b564d5b1760a34edbf765958f27a7729
      https://github.com/ckan/ckan/commit/1ff29e60b564d5b1760a34edbf765958f27a7729
  Author: amercader <amercadero at gmail.com>
  Date:   2016-03-10 (Thu, 10 Mar 2016)

  Changed paths:
    M ckan/tests/config/test_middleware.py
    M setup.py

  Log Message:
  -----------
  [#2845] Fist bunch of tests


  Commit: 882890cf48c873f2ec01e6e57cee529984cee59c
      https://github.com/ckan/ckan/commit/882890cf48c873f2ec01e6e57cee529984cee59c
  Author: amercader <amercadero at gmail.com>
  Date:   2016-03-10 (Thu, 10 Mar 2016)

  Changed paths:
    M ckan/config/middleware.py

  Log Message:
  -----------
  [#2845] Add missing test route


  Commit: 6e0565023b14331b771d72c2c13ebd362b86f162
      https://github.com/ckan/ckan/commit/6e0565023b14331b771d72c2c13ebd362b86f162
  Author: amercader <amercadero at gmail.com>
  Date:   2016-03-10 (Thu, 10 Mar 2016)

  Changed paths:
    A .github/ISSUE_TEMPLATE.md
    A .github/PULL_REQUEST_TEMPLATE.md
    M .travis.yml
    A bin/postgres_init/1_create_ckan_db.sh
    A bin/postgres_init/2_create_ckan_datastore_db.sh
    M bin/travis-install-dependencies
    M circle.yml
    M ckan/controllers/user.py
    M ckan/lib/cli.py
    R ckan/lib/dumper.py
    M ckan/plugins/interfaces.py
    M ckan/public/base/javascript/modules/image-upload.js
    M ckan/public/base/test/index.html
    A ckan/public/base/test/spec/modules/image-upload.spec.js
    M ckan/tests/controllers/test_user.py
    M ckan/tests/legacy/lib/test_cli.py
    R ckan/tests/legacy/test_dumper.py
    M ckan/tests/logic/action/test_get.py
    M doc/contributing/i18n.rst
    M doc/maintaining/configuration.rst
    M doc/maintaining/paster.rst

  Log Message:
  -----------
  Merge branch 'master' into 2845-wsgi-dispatcher


  Commit: e30d23e341462dd5fb2ceb3b4ca2850fb70afc01
      https://github.com/ckan/ckan/commit/e30d23e341462dd5fb2ceb3b4ca2850fb70afc01
  Author: amercader <amercadero at gmail.com>
  Date:   2016-03-11 (Fri, 11 Mar 2016)

  Changed paths:
    M ckan/tests/config/test_middleware.py

  Log Message:
  -----------
  [#2845] Don't import setup_testing_defaults directly

Otherwise nose thinks it's a test for some reason and runs it. Silly
nose


  Commit: c4ade294fafb8e5d2b79c27267d6a2a1a78829c2
      https://github.com/ckan/ckan/commit/c4ade294fafb8e5d2b79c27267d6a2a1a78829c2
  Author: amercader <amercadero at gmail.com>
  Date:   2016-03-11 (Fri, 11 Mar 2016)

  Changed paths:
    M ckan/controllers/partyline.py
    M ckan/tests/config/test_middleware.py

  Log Message:
  -----------
  [#2845] Add more tests


  Commit: b1fb19e9dc52c13967dcec98003924961ac5f7d1
      https://github.com/ckan/ckan/commit/b1fb19e9dc52c13967dcec98003924961ac5f7d1
  Author: David Read <david.read at hackneyworkshop.com>
  Date:   2016-03-15 (Tue, 15 Mar 2016)

  Changed paths:
    M ckan/config/middleware.py
    M ckan/config/routing.py
    A ckan/controllers/partyline.py
    M ckan/tests/config/test_middleware.py
    M requirements.in
    M requirements.txt
    M setup.py

  Log Message:
  -----------
  Merge pull request #2905 from ckan/2845-wsgi-dispatcher

[#2845] WSGI Dispatcher


Compare: https://github.com/ckan/ckan/compare/c6e24f0c6eed...b1fb19e9dc52


More information about the ckan-changes mailing list