[ckan-changes] [ckan/ckan] c2aa9c: Call the i18n Middleware first before asking the a...

GitHub noreply at github.com
Thu Jun 23 09:59:18 UTC 2016


  Branch: refs/heads/poc-flask-views
  Home:   https://github.com/ckan/ckan
  Commit: c2aa9c0ac41d076802362a7fe13369cbd7b53f30
      https://github.com/ckan/ckan/commit/c2aa9c0ac41d076802362a7fe13369cbd7b53f30
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-07 (Tue, 07 Jun 2016)

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

  Log Message:
  -----------
  Call the i18n Middleware first before asking the apps

The i18n will remove the locale part of the environ['PATH_INFO']
(eg `fr` in `/fr/dataset`) and set the necessary lang vars in the
environ. We need to remove that before asking the apps if they can
handle a request, otherwise localized URLs won't get recognized.


  Commit: 26c1bd3fb4b1bb6ad96c77a5f4b008dc0f390b78
      https://github.com/ckan/ckan/commit/26c1bd3fb4b1bb6ad96c77a5f4b008dc0f390b78
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-07 (Tue, 07 Jun 2016)

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

  Log Message:
  -----------
  Add helper reference to the actual Flask stack


  Commit: 62f55d2c96f84983ce8efb8217e7286588cf23e0
      https://github.com/ckan/ckan/commit/62f55d2c96f84983ce8efb8217e7286588cf23e0
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-07 (Tue, 07 Jun 2016)

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

  Log Message:
  -----------
  Support for cross-app URL generation

In order for the URL generation to work in the context of both applications,
some changes are made at the top of the middleware stack just before
dispatching the request to the relevant app. Essentially, if Flask is serving
the request we create a Routes request_config object and attach the Routes
mapper to it, and if it is a Pylons request, we wrap it with
`flask_app.test_request_context(environ_overrides=environ)`


  Commit: bf51545dbeca029ccdf60737c3112f147594206f
      https://github.com/ckan/ckan/commit/bf51545dbeca029ccdf60737c3112f147594206f
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-07 (Tue, 07 Jun 2016)

  Changed paths:
    M ckan/lib/helpers.py

  Log Message:
  -----------
  New version of url_for that supports both Flask and Pylons

There's a lot of parameters handling to support both syntaxes:

Pylons
url = url_for(controller='api', action='action', ver=3,
       qualified=True)

Flask
url = url_for('api.action', ver=3, _external=True)

Essentially this calls the Flask url_for function and falls back to
Pylons if it wasn't found.


  Commit: 51805b2a94f7bd0139ea7d9fb5afe2936e8cd8b7
      https://github.com/ckan/ckan/commit/51805b2a94f7bd0139ea7d9fb5afe2936e8cd8b7
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-07 (Tue, 07 Jun 2016)

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

  Log Message:
  -----------
  Set SERVER_NAME on Flask config

Automatically set SERVER_NAME from the value of ckan.site_url. This is
needed so Flask is able to generate fully qualified URLs with
_external=True. One major thing to note is that when SERVER_NAME is set
up the incoming request `Host` header (`HTTP_HOST` in the WSGI environ)
must match its value, otherwise the Flask router will return a 404 even
if the route has been defined.

That's why we had to modify
1. The environ sent during the WSGI party invite requests
2. The environ sent with the test webtest app in tests


  Commit: 5d70f308fce34d53326b1bc2ca2aa618b2d72747
      https://github.com/ckan/ckan/commit/5d70f308fce34d53326b1bc2ca2aa618b2d72747
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-07 (Tue, 07 Jun 2016)

  Changed paths:
    M ckan/tests/helpers.py

  Log Message:
  -----------
  Allow to modify the configuration of the test app


  Commit: c9cef38ade36b369720d62fa5afe76b0e4a463eb
      https://github.com/ckan/ckan/commit/c9cef38ade36b369720d62fa5afe76b0e4a463eb
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-07 (Tue, 07 Jun 2016)

  Changed paths:
    M ckan/tests/lib/test_helpers.py

  Log Message:
  -----------
  New tests for Flask URL generation


  Commit: 45371daa933e2991eb678e3d132a153b594ef83a
      https://github.com/ckan/ckan/commit/45371daa933e2991eb678e3d132a153b594ef83a
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-08 (Wed, 08 Jun 2016)

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

  Log Message:
  -----------
  Add extra stuff to the WSGI environ sent during invites

Also set SERVER_NAME and SERVER_PORT for consistency, and set up a
vendor CKAN key to be able to identify the environ as one of the ones
used for sending the WSGI invites. This is needed so the `is_flask`
function correctly returns the relevant value based on the request
environ.


  Commit: b96d32da85033cf281b793191427059facf94c24
      https://github.com/ckan/ckan/commit/b96d32da85033cf281b793191427059facf94c24
  Author: Brook Elgie <specialbrew at gmail.com>
  Date:   2016-06-08 (Wed, 08 Jun 2016)

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

  Log Message:
  -----------
  Only return session if it's available on environ


  Commit: 77e0cfa28f471a207dc4c7ce17c80016fbcfe9b6
      https://github.com/ckan/ckan/commit/77e0cfa28f471a207dc4c7ce17c80016fbcfe9b6
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-08 (Wed, 08 Jun 2016)

  Changed paths:
    M ckan/tests/controllers/test_admin.py
    M ckan/tests/controllers/test_api.py
    M ckan/tests/controllers/test_feed.py
    M ckan/tests/controllers/test_group.py
    M ckan/tests/controllers/test_home.py
    M ckan/tests/controllers/test_organization.py
    M ckan/tests/controllers/test_package.py
    M ckan/tests/controllers/test_tags.py
    M ckan/tests/controllers/test_user.py
    M ckan/tests/controllers/test_util.py
    M ckan/tests/lib/test_helpers.py
    M ckan/tests/lib/test_mailer.py

  Log Message:
  -----------
  Fix ckan/ tests (no legacy) depending on url_for

The Flask url_for function requires an application context to be present
when generating a url_for. This is obviously not the case when calling
it from a test, so we need to wrap the function on a
test_request_context (which will create an app context):
   with app.flask_app.test_request_context():
      url_for(...)

For tests that don't require an app like helpers or mailer this is done
automatically in the tests setup.

Note that all URLs generated now take ckan.site_url into account, so tests
checking for `http://localhost/some-url` will fail as the correct url is
`http://test.ckan.net/some-url`, as this is the site_url used on test-core.ini.


  Commit: ea7331e8921ff3ffd3ab362637e425578ca16123
      https://github.com/ckan/ckan/commit/ea7331e8921ff3ffd3ab362637e425578ca16123
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-08 (Wed, 08 Jun 2016)

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

  Log Message:
  -----------
  PEP8 fixes


  Commit: 8f0db2637c478f1bee705847d7bfc1baac6ad7e0
      https://github.com/ckan/ckan/commit/8f0db2637c478f1bee705847d7bfc1baac6ad7e0
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-08 (Wed, 08 Jun 2016)

  Changed paths:
    M ckan/common.py

  Log Message:
  -----------
  Provide support for request.params even on a Flask request

It is used all over the place and they both are dict-like objects


  Commit: c00b457e5adf727ad1da7e6111e8b08b77dee728
      https://github.com/ckan/ckan/commit/c00b457e5adf727ad1da7e6111e8b08b77dee728
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-08 (Wed, 08 Jun 2016)

  Changed paths:
    M ckan/common.py
    M ckan/config/middleware/flask_app.py
    M ckan/lib/helpers.py

  Log Message:
  -----------
  Merge branch 'poc-flask-views.common-url_for-take-2' into poc-flask-views.common-url_for-take-2-tests


  Commit: d1adfe792f5d1a87af21d4b52aa300520e8c326d
      https://github.com/ckan/ckan/commit/d1adfe792f5d1a87af21d4b52aa300520e8c326d
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-08 (Wed, 08 Jun 2016)

  Changed paths:
    M ckan/tests/controllers/test_package.py
    M ckan/tests/controllers/test_user.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/model/test_relationships.py
    M ckan/tests/legacy/functional/api/model/test_vocabulary.py
    M ckan/tests/legacy/functional/api/test_activity.py
    M ckan/tests/legacy/functional/api/test_dashboard.py
    M ckan/tests/legacy/functional/api/test_email_notifications.py
    M ckan/tests/legacy/functional/api/test_follow.py
    M ckan/tests/legacy/functional/api/test_resource.py
    M ckan/tests/legacy/functional/api/test_user.py
    M ckan/tests/legacy/functional/api/test_util.py
    M ckan/tests/legacy/functional/test_activity.py
    M ckan/tests/legacy/functional/test_admin.py
    M ckan/tests/legacy/functional/test_group.py
    M ckan/tests/legacy/functional/test_package.py
    M ckan/tests/legacy/functional/test_pagination.py
    M ckan/tests/legacy/functional/test_preview_interface.py
    M ckan/tests/legacy/functional/test_revision.py
    M ckan/tests/legacy/functional/test_tag.py
    M ckan/tests/legacy/functional/test_tracking.py
    M ckan/tests/legacy/functional/test_user.py
    M ckan/tests/legacy/html_check.py
    M ckan/tests/legacy/logic/test_action.py
    M ckan/tests/legacy/logic/test_auth.py
    M ckan/tests/legacy/misc/test_format_text.py
    M ckan/tests/legacy/models/test_package.py
    M ckan/tests/legacy/test_coding_standards.py

  Log Message:
  -----------
  First go at fixing the legacy tests

Wrapping calls to url_for (and functions that call it firther down the
line) with the Flask test_request_context, update functional tests to
use the helpers._get_test_app function rather than old paster ones.


  Commit: 3298f6924a127ceca8ca38eb81cd018d68d9534a
      https://github.com/ckan/ckan/commit/3298f6924a127ceca8ca38eb81cd018d68d9534a
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-09 (Thu, 09 Jun 2016)

  Changed paths:
    M ckanext/datapusher/tests/test.py
    M ckanext/datapusher/tests/test_interfaces.py
    M ckanext/datastore/tests/test_create.py
    M ckanext/datastore/tests/test_delete.py
    M ckanext/datastore/tests/test_dump.py
    M ckanext/datastore/tests/test_upsert.py
    M ckanext/example_iauthfunctions/tests/test_example_iauthfunctions.py
    M ckanext/example_idatasetform/tests/test_controllers.py
    M ckanext/example_igroupform/tests/test_controllers.py
    M ckanext/example_itranslation/tests/test_plugin.py
    M ckanext/imageview/tests/test_view.py
    M ckanext/multilingual/tests/test_multilingual_plugin.py
    M ckanext/reclineview/tests/test_view.py
    M ckanext/resourceproxy/tests/test_proxy.py
    M ckanext/stats/tests/test_stats_plugin.py
    M ckanext/textview/tests/test_view.py

  Log Message:
  -----------
  Fix ckanext tests

Same as previous commits, using the app from
tests.helpers._get_test_app and request contexts when necessary

Conflicts:
	ckanext/imageview/tests/test_view.py


  Commit: 0d0763007a7e4faa4d40ee4bad0c1a8d402a1d65
      https://github.com/ckan/ckan/commit/0d0763007a7e4faa4d40ee4bad0c1a8d402a1d65
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-09 (Thu, 09 Jun 2016)

  Changed paths:
    M ckan/tests/helpers.py
    M ckan/tests/lib/test_helpers.py

  Log Message:
  -----------
  Revert "Allow to modify the configuration of the test app"

This reverts commit 5d70f308fce34d53326b1bc2ca2aa618b2d72747.


  Commit: a5600e5f5af6061dc363db44d4eff2602b01d7ad
      https://github.com/ckan/ckan/commit/a5600e5f5af6061dc363db44d4eff2602b01d7ad
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-09 (Thu, 09 Jun 2016)

  Changed paths:
    M ckan/tests/config/test_sessions.py
    M ckan/views/api.py
    M ckanext/example_flask_iblueprint/plugin.py
    M ckanext/example_flask_iblueprint/tests/test_routes.py
    M ckanext/example_iauthfunctions/tests/test_example_iauthfunctions.py
    M ckanext/example_igroupform/tests/test_controllers.py
    M ckanext/example_itranslation/tests/test_plugin.py

  Log Message:
  -----------
  Fix coding standards issues


  Commit: bd6372b54282835b9a8b5489ea085f99a181ad15
      https://github.com/ckan/ckan/commit/bd6372b54282835b9a8b5489ea085f99a181ad15
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-09 (Thu, 09 Jun 2016)

  Changed paths:
    M ckan/config/middleware/flask_app.py
    M ckan/lib/base.py
    M ckan/tests/config/test_middleware.py
    M ckan/tests/config/test_sessions.py
    M ckan/views/__init__.py
    M ckan/views/api.py
    M ckanext/example_flask_iblueprint/plugin.py
    M ckanext/example_flask_iblueprint/tests/test_routes.py

  Log Message:
  -----------
  Merge branch 'poc-flask-views' into poc-flask-views.common-url_for-take-2

Conflicts:
	ckan/config/middleware/flask_app.py


  Commit: 8bf303e83bbaa9ff3404ec26ac4a7200c0a18c61
      https://github.com/ckan/ckan/commit/8bf303e83bbaa9ff3404ec26ac4a7200c0a18c61
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-09 (Thu, 09 Jun 2016)

  Changed paths:
    M ckan/tests/helpers.py

  Log Message:
  -----------
  Revert "Allow to modify the configuration of the test app"

This reverts commit 5d70f308fce34d53326b1bc2ca2aa618b2d72747.


  Commit: f83af0869bf5a700be7e3898e57ab39bc6c1f986
      https://github.com/ckan/ckan/commit/f83af0869bf5a700be7e3898e57ab39bc6c1f986
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-09 (Thu, 09 Jun 2016)

  Changed paths:
    M ckan/config/middleware/flask_app.py
    M ckan/lib/base.py
    M ckan/tests/config/test_middleware.py
    M ckan/tests/config/test_sessions.py
    M ckan/views/__init__.py
    M ckan/views/api.py

  Log Message:
  -----------
  Merge branch 'poc-flask-views.common-url_for-take-2' into poc-flask-views.common-url_for-take-2-tests


  Commit: 27852829ed68b49766279cca9dba55edb023e194
      https://github.com/ckan/ckan/commit/27852829ed68b49766279cca9dba55edb023e194
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-10 (Fri, 10 Jun 2016)

  Changed paths:
    M ckanext/resourceproxy/tests/test_proxy.py

  Log Message:
  -----------
  Cleanup after resource proxy test


  Commit: 3ce78d01a10b82df9a81e52fc017ed8ca538ef62
      https://github.com/ckan/ckan/commit/3ce78d01a10b82df9a81e52fc017ed8ca538ef62
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-10 (Fri, 10 Jun 2016)

  Changed paths:
    M ckan/common.py

  Log Message:
  -----------
  Cover some more cases on is_flask


  Commit: 92a10845b37e3550eaf6ed0d8a9a685fcd4c61ef
      https://github.com/ckan/ckan/commit/92a10845b37e3550eaf6ed0d8a9a685fcd4c61ef
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-10 (Fri, 10 Jun 2016)

  Changed paths:
    M ckan/common.py

  Log Message:
  -----------
  Merge branch 'poc-flask-views.common-url_for-take-2' into poc-flask-views.common-url_for-take-2-tests


  Commit: 2fdbbe6b52ac9750c7cea676125ce638db086595
      https://github.com/ckan/ckan/commit/2fdbbe6b52ac9750c7cea676125ce638db086595
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-10 (Fri, 10 Jun 2016)

  Changed paths:
    M ckan/lib/activity_streams.py
    M ckan/lib/base.py

  Log Message:
  -----------
  Quick and dirty changes to make lib.base.render work on Flask

This needs to be properly investigated, specially all the logic around
caching


  Commit: ff959f793fcde89d178c49058f9eebba706c6fe6
      https://github.com/ckan/ckan/commit/ff959f793fcde89d178c49058f9eebba706c6fe6
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-10 (Fri, 10 Jun 2016)

  Changed paths:
    M ckan/templates/activity_streams/activity_stream_email_notifications.text

  Log Message:
  -----------
  Temporary fix in template


  Commit: 6664c82ba5d4c7615c65f05a17c15f0292a80abf
      https://github.com/ckan/ckan/commit/6664c82ba5d4c7615c65f05a17c15f0292a80abf
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-10 (Fri, 10 Jun 2016)

  Changed paths:
    M ckan/lib/activity_streams.py
    M ckan/lib/base.py

  Log Message:
  -----------
  Quick and dirty changes to make lib.base.render work on Flask

This needs to be properly investigated, specially all the logic around
caching


  Commit: 126792a3a83821a035b7ee7090a80ac7d6323a99
      https://github.com/ckan/ckan/commit/126792a3a83821a035b7ee7090a80ac7d6323a99
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-14 (Tue, 14 Jun 2016)

  Changed paths:
    M ckan/config/middleware/flask_app.py
    M ckan/lib/base.py
    M ckan/tests/config/test_middleware.py
    M ckan/tests/helpers.py
    M ckan/tests/lib/test_base.py
    M ckan/views/__init__.py
    M ckan/views/api.py
    M setup.py

  Log Message:
  -----------
  Merge branch 'poc-flask-views' into poc-flask-views.common-url_for-take-2

Conflicts:
	ckan/lib/base.py


  Commit: b9a7be2201cbb3d4991150b475bb4bfd7123d541
      https://github.com/ckan/ckan/commit/b9a7be2201cbb3d4991150b475bb4bfd7123d541
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-14 (Tue, 14 Jun 2016)

  Changed paths:
    M ckan/config/middleware/flask_app.py
    M ckan/lib/base.py
    M ckan/tests/config/test_middleware.py
    M ckan/tests/helpers.py
    M ckan/tests/lib/test_base.py
    M ckan/views/__init__.py
    M ckan/views/api.py
    M setup.py

  Log Message:
  -----------
  Merge branch 'poc-flask-views.common-url_for-take-2' into poc-flask-views.common-url_for-take-2-tests

Conflicts:
	ckan/lib/base.py


  Commit: 0884c488db0b8900fbecff15d4e42d6db40000dd
      https://github.com/ckan/ckan/commit/0884c488db0b8900fbecff15d4e42d6db40000dd
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-23 (Thu, 23 Jun 2016)

  Changed paths:
    M ckan/common.py
    M ckan/config/middleware/flask_app.py
    M ckan/lib/base.py
    M ckan/templates/activity_streams/activity_stream_email_notifications.text
    M ckan/tests/config/test_middleware.py
    M ckan/tests/config/test_sessions.py
    M ckan/tests/lib/test_base.py
    M ckan/views/__init__.py
    M ckanext/example_flask_iblueprint/tests/test_routes.py
    M requirements.in
    M requirements.txt

  Log Message:
  -----------
  Merge branch 'poc-flask-views' into poc-flask-views.common-url_for-take-2


  Commit: 57344651dc1681770ff3bbee0f5acc4f89398026
      https://github.com/ckan/ckan/commit/57344651dc1681770ff3bbee0f5acc4f89398026
  Author: amercader <amercadero at gmail.com>
  Date:   2016-06-23 (Thu, 23 Jun 2016)

  Changed paths:
    M ckan/common.py
    M ckan/config/middleware/flask_app.py
    M ckan/lib/base.py
    M ckan/tests/config/test_middleware.py
    M ckan/tests/config/test_sessions.py
    M ckan/tests/lib/test_base.py
    M ckan/views/__init__.py
    M ckanext/example_flask_iblueprint/tests/test_routes.py
    M requirements.in
    M requirements.txt

  Log Message:
  -----------
  Merge branch 'poc-flask-views.common-url_for-take-2' into poc-flask-views.common-url_for-take-2-tests


Compare: https://github.com/ckan/ckan/compare/60930a27d09a...57344651dc16


More information about the ckan-changes mailing list