Skip to content

Commit

Permalink
Merge branch 'master' into 3196-i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Mar 8, 2017
2 parents fbb341d + efcfe97 commit 6e11e61
Show file tree
Hide file tree
Showing 261 changed files with 3,690 additions and 8,608 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
@@ -0,0 +1,17 @@
# EditorConfig http://EditorConfig.org

# Project Root
root = true

# Default Code Style
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

# Python Code Style
[*.py]
indent_size = 4
57 changes: 57 additions & 0 deletions CHANGELOG.rst
Expand Up @@ -19,6 +19,28 @@ API changes and deprecations:
helper) now default to not include package_count. Pass
include_dataset_count=True if you need the package_count values.
* ``resource['size']`` will change from string to long integer (#3205)
* upgrade Font-Awesome from version 3.2.1 to 4.0.3
please refer to
https://github.com/FortAwesome/Font-Awesome/wiki/Upgrading-from-3.2.1-to-4
to upgrade your code accordingly.

v2.6.1 2017-02-22
=================

* Fix DataPusher being fired multiple times (#3245)
* Use the url_for() helper for datapusher URLs (#2866)
* Resource creation date use datetime.utcnow() (#3447)
* Fix locale error when using fix ckan.root_path
* `render_markdown` breaks links with ampersands
* Check group name and id during package creation
* Use utcnow() on dashboard_mark_activities_old (#3373)
* Fix encoding error on DataStore exception
* Datastore doesn't add site_url to resource created via API (#3189)
* Fix memberships after user deletion (#3265)
* Remove idle database connection (#3260)
* Fix package_owner_org_update action when called via the API (#2661)
* Fix French locale (#3327)
* Updated translations

v2.6.0 2016-11-02
=================
Expand Down Expand Up @@ -117,6 +139,21 @@ Bug fixes:
API changes and deprecations:
* Replace `c.__version__` with new helper `h.ckan_version()` (#3103)

v2.5.4 2017-02-22
=================

* Fix DataPusher being fired multiple times (#3245)
* Use the url_for() helper for datapusher URLs (#2866)
* Resource creation date use datetime.utcnow() (#3447)
* Fix locale error when using fix ckan.root_path
* `render_markdown` breaks links with ampersands
* Check group name and id during package creation
* Use utcnow() on dashboard_mark_activities_old (#3373)
* Fix encoding error on DataStore exception
* Datastore doesn't add site_url to resource created via API (#3189)
* Fix memberships after user deletion (#3265)
* Remove idle database connection (#3260)
* Fix package_owner_org_update action when called via the API (#2661)

v2.5.3 2016-11-02
=================
Expand Down Expand Up @@ -219,6 +256,26 @@ v2.5.0 2015-12-17

Cancelled release

v2.4.6 2017-02-22
=================

* Use the url_for() helper for datapusher URLs (#2866)
* Resource creation date use datetime.utcnow() (#3447)
* Fix locale error when using fix ckan.root_path
* `render_markdown` breaks links with ampersands
* Check group name and id during package creation
* Use utcnow() on dashboard_mark_activities_old (#3373)
* Fix encoding error on DataStore exception
* Datastore doesn't add site_url to resource created via API (#3189)
* Fix memberships after user deletion (#3265)
* Remove idle database connection (#3260)
* Fix package_owner_org_update action when called via the API (#2661)

v2.4.5 2017-02-22
=================

Cancelled release

v2.4.4 2016-11-02
=================

Expand Down
11 changes: 10 additions & 1 deletion ckan/common.py
Expand Up @@ -20,7 +20,8 @@
from pylons.i18n import (ugettext as pylons_ugettext,
ungettext as pylons_ungettext)

from pylons import session, response
from pylons import response

import simplejson as json

try:
Expand Down Expand Up @@ -167,6 +168,13 @@ def _get_c():
return pylons.c


def _get_session():
if is_flask_request():
return flask.session
else:
return pylons.session


local = Local()

# This a proxy to the bounded config object
Expand All @@ -179,3 +187,4 @@ def _get_c():
request = CKANRequest(_get_request)
# Provide a `c` alias for `g` for backwards compatibility
g = c = LocalProxy(_get_c)
session = LocalProxy(_get_session)
1 change: 0 additions & 1 deletion ckan/config/environment.py
Expand Up @@ -256,7 +256,6 @@ def update_config():
env.install_gettext_callables(_, ungettext, newstyle=True)
# custom filters
env.filters['empty_and_escape'] = jinja_extensions.empty_and_escape
env.filters['truncate'] = jinja_extensions.truncate
config['pylons.app_globals'].jinja_env = env

# CONFIGURATION OPTIONS HERE (note: all config options will override
Expand Down
26 changes: 25 additions & 1 deletion ckan/config/middleware/flask_app.py
Expand Up @@ -8,13 +8,15 @@

from flask import Flask, Blueprint
from flask.ctx import _AppCtxGlobals
from flask.sessions import SessionInterface

from werkzeug.exceptions import HTTPException
from werkzeug.routing import Rule

from flask_babel import Babel
from flask_debugtoolbar import DebugToolbarExtension

from beaker.middleware import SessionMiddleware
from paste.deploy.converters import asbool
from fanstatic import Fanstatic

Expand Down Expand Up @@ -72,6 +74,28 @@ def make_flask_stack(conf, **app_conf):
app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False
DebugToolbarExtension(app)

# Use Beaker as the Flask session interface
class BeakerSessionInterface(SessionInterface):
def open_session(self, app, request):
if 'beaker.session' in request.environ:
return request.environ['beaker.session']

def save_session(self, app, session, response):
session.save()

namespace = 'beaker.session.'
session_opts = dict([(k.replace('beaker.', ''), v)
for k, v in config.iteritems()
if k.startswith(namespace)])
if (not session_opts.get('session.data_dir') and
session_opts.get('session.type', 'file') == 'file'):
cache_dir = app_conf.get('cache_dir') or app_conf.get('cache.dir')
session_opts['session.data_dir'] = '{data_dir}/sessions'.format(
data_dir=cache_dir)

app.wsgi_app = SessionMiddleware(app.wsgi_app, session_opts)
app.session_interface = BeakerSessionInterface()

# Add Jinja2 extensions and filters
extensions = [
'jinja2.ext.do', 'jinja2.ext.with_',
Expand All @@ -87,7 +111,6 @@ def make_flask_stack(conf, **app_conf):
app.jinja_env.add_extension(extension)
app.jinja_env.filters['empty_and_escape'] = \
jinja_extensions.empty_and_escape
app.jinja_env.filters['truncate'] = jinja_extensions.truncate

# Common handlers for all requests
app.before_request(ckan_before_request)
Expand Down Expand Up @@ -132,6 +155,7 @@ def hello_world_post():
app.register_extension_blueprint(plugin.get_blueprint())

# Start other middleware

for plugin in PluginImplementations(IMiddleware):
app = plugin.make_middleware(app, config)

Expand Down
4 changes: 2 additions & 2 deletions ckan/config/middleware/pylons_app.py
Expand Up @@ -55,6 +55,8 @@ def make_pylons_stack(conf, full_stack=True, static_files=True,
for plugin in PluginImplementations(IMiddleware):
app = plugin.make_middleware(app, config)

app = common_middleware.RootPathMiddleware(app, config)

# Routing/Session/Cache Middleware
app = RoutesMiddleware(app, config['routes.map'])
# we want to be able to retrieve the routes middleware to be able to update
Expand Down Expand Up @@ -173,8 +175,6 @@ def make_pylons_stack(conf, full_stack=True, static_files=True,
if asbool(config.get('ckan.tracking_enabled', 'false')):
app = common_middleware.TrackingMiddleware(app, config)

app = common_middleware.RootPathMiddleware(app, config)

# Add a reference to the actual Pylons app so it's easier to access
app._wsgi_app = pylons_app

Expand Down
48 changes: 24 additions & 24 deletions ckan/config/routing.py
Expand Up @@ -239,24 +239,24 @@ def make_map():
'api_data',
])))
m.connect('dataset_edit', '/dataset/edit/{id}', action='edit',
ckan_icon='edit')
ckan_icon='pencil-square-o')
m.connect('dataset_followers', '/dataset/followers/{id}',
action='followers', ckan_icon='group')
action='followers', ckan_icon='users')
m.connect('dataset_activity', '/dataset/activity/{id}',
action='activity', ckan_icon='time')
action='activity', ckan_icon='clock-o')
m.connect('/dataset/activity/{id}/{offset}', action='activity')
m.connect('dataset_groups', '/dataset/groups/{id}',
action='groups', ckan_icon='group')
action='groups', ckan_icon='users')
m.connect('dataset_resources', '/dataset/resources/{id}',
action='resources', ckan_icon='reorder')
action='resources', ckan_icon='bars')
m.connect('dataset_read', '/dataset/{id}', action='read',
ckan_icon='sitemap')
m.connect('/dataset/{id}/resource/{resource_id}',
action='resource_read')
m.connect('/dataset/{id}/resource_delete/{resource_id}',
action='resource_delete')
m.connect('resource_edit', '/dataset/{id}/resource_edit/{resource_id}',
action='resource_edit', ckan_icon='edit')
action='resource_edit', ckan_icon='pencil-square-o')
m.connect('/dataset/{id}/resource/{resource_id}/download',
action='resource_download')
m.connect('/dataset/{id}/resource/{resource_id}/download/{filename}',
Expand All @@ -269,12 +269,12 @@ def make_map():
m.connect('/dataset/{id}/resource/{resource_id}/preview',
action='resource_datapreview')
m.connect('views', '/dataset/{id}/resource/{resource_id}/views',
action='resource_views', ckan_icon='reorder')
action='resource_views', ckan_icon='bars')
m.connect('new_view', '/dataset/{id}/resource/{resource_id}/new_view',
action='edit_view', ckan_icon='edit')
action='edit_view', ckan_icon='pencil-square-o')
m.connect('edit_view',
'/dataset/{id}/resource/{resource_id}/edit_view/{view_id}',
action='edit_view', ckan_icon='edit')
action='edit_view', ckan_icon='pencil-square-o')
m.connect('resource_view',
'/dataset/{id}/resource/{resource_id}/view/{view_id}',
action='resource_view')
Expand Down Expand Up @@ -306,13 +306,13 @@ def make_map():
'activity',
])))
m.connect('group_about', '/group/about/{id}', action='about',
ckan_icon='info-sign'),
ckan_icon='info-circle'),
m.connect('group_edit', '/group/edit/{id}', action='edit',
ckan_icon='edit')
ckan_icon='pencil-square-o')
m.connect('group_members', '/group/members/{id}', action='members',
ckan_icon='group'),
ckan_icon='users'),
m.connect('group_activity', '/group/activity/{id}/{offset}',
action='activity', ckan_icon='time'),
action='activity', ckan_icon='clock-o'),
m.connect('group_read', '/group/{id}', action='read',
ckan_icon='sitemap')

Expand All @@ -330,16 +330,16 @@ def make_map():
'history'
])))
m.connect('organization_activity', '/organization/activity/{id}/{offset}',
action='activity', ckan_icon='time')
action='activity', ckan_icon='clock-o')
m.connect('organization_read', '/organization/{id}', action='read')
m.connect('organization_about', '/organization/about/{id}',
action='about', ckan_icon='info-sign')
action='about', ckan_icon='info-circle')
m.connect('organization_read', '/organization/{id}', action='read',
ckan_icon='sitemap')
m.connect('organization_edit', '/organization/edit/{id}',
action='edit', ckan_icon='edit')
action='edit', ckan_icon='pencil-square-o')
m.connect('organization_members', '/organization/members/{id}',
action='members', ckan_icon='group')
action='members', ckan_icon='users')
m.connect('organization_bulk_process',
'/organization/bulk_process/{id}',
action='bulk_process', ckan_icon='sitemap')
Expand All @@ -363,20 +363,20 @@ def make_map():
m.connect('user_generate_apikey', '/user/generate_key/{id}', action='generate_apikey')
m.connect('/user/activity/{id}/{offset}', action='activity')
m.connect('user_activity_stream', '/user/activity/{id}',
action='activity', ckan_icon='time')
action='activity', ckan_icon='clock-o')
m.connect('user_dashboard', '/dashboard', action='dashboard',
ckan_icon='list')
m.connect('user_dashboard_datasets', '/dashboard/datasets',
action='dashboard_datasets', ckan_icon='sitemap')
m.connect('user_dashboard_groups', '/dashboard/groups',
action='dashboard_groups', ckan_icon='group')
action='dashboard_groups', ckan_icon='users')
m.connect('user_dashboard_organizations', '/dashboard/organizations',
action='dashboard_organizations', ckan_icon='building')
action='dashboard_organizations', ckan_icon='building-o')
m.connect('/dashboard/{offset}', action='dashboard')
m.connect('user_follow', '/user/follow/{id}', action='follow')
m.connect('/user/unfollow/{id}', action='unfollow')
m.connect('user_followers', '/user/followers/{id:.*}',
action='followers', ckan_icon='group')
action='followers', ckan_icon='users')
m.connect('user_edit', '/user/edit/{id:.*}', action='edit',
ckan_icon='cog')
m.connect('user_delete', '/user/delete/{id}', action='delete')
Expand Down Expand Up @@ -410,11 +410,11 @@ def make_map():
m.connect('/feeds/custom.atom', action='custom')

map.connect('ckanadmin_index', '/ckan-admin', controller='admin',
action='index', ckan_icon='legal')
action='index', ckan_icon='gavel')
map.connect('ckanadmin_config', '/ckan-admin/config', controller='admin',
action='config', ckan_icon='check')
action='config', ckan_icon='check-square-o')
map.connect('ckanadmin_trash', '/ckan-admin/trash', controller='admin',
action='trash', ckan_icon='trash')
action='trash', ckan_icon='trash-o')
map.connect('ckanadmin', '/ckan-admin/{action}', controller='admin')

with SubMapper(map, controller='ckan.controllers.storage:StorageController') as m:
Expand Down
3 changes: 2 additions & 1 deletion ckan/controllers/user.py
Expand Up @@ -79,7 +79,8 @@ def _setup_template_variables(self, context, data_dict):
try:
user_dict = get_action('user_show')(context, data_dict)
except NotFound:
abort(404, _('User not found'))
h.flash_error(_('Not authorized to see this page'))
h.redirect_to(controller='user', action='login')
except NotAuthorized:
abort(403, _('Not authorized to see this page'))

Expand Down
Binary file modified ckan/i18n/ar/LC_MESSAGES/ckan.mo
Binary file not shown.
2 changes: 1 addition & 1 deletion ckan/i18n/ar/LC_MESSAGES/ckan.po
Expand Up @@ -10,7 +10,7 @@ msgstr ""
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2016-10-18 10:37+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Adrià Mercader <amercadero@gmail.com>, 2016\n"
"Last-Translator: Adrià Mercader <adria.mercader@okfn.org>, 2016\n"
"Language-Team: Arabic (https://www.transifex.com/okfn/teams/11162/ar/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
Expand Down
Binary file modified ckan/i18n/bg/LC_MESSAGES/ckan.mo
Binary file not shown.
2 changes: 1 addition & 1 deletion ckan/i18n/bg/LC_MESSAGES/ckan.po
Expand Up @@ -10,7 +10,7 @@ msgstr ""
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2016-10-18 10:37+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Adrià Mercader <amercadero@gmail.com>, 2016\n"
"Last-Translator: Adrià Mercader <adria.mercader@okfn.org>, 2016\n"
"Language-Team: Bulgarian (https://www.transifex.com/okfn/teams/11162/bg/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
Expand Down
Binary file modified ckan/i18n/ca/LC_MESSAGES/ckan.mo
Binary file not shown.
2 changes: 1 addition & 1 deletion ckan/i18n/ca/LC_MESSAGES/ckan.po
Expand Up @@ -10,7 +10,7 @@ msgstr ""
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2016-10-18 10:37+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Adrià Mercader <amercadero@gmail.com>, 2016\n"
"Last-Translator: Adrià Mercader <adria.mercader@okfn.org>, 2016\n"
"Language-Team: Catalan (https://www.transifex.com/okfn/teams/11162/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
Expand Down
Binary file modified ckan/i18n/cs_CZ/LC_MESSAGES/ckan.mo
Binary file not shown.
2 changes: 1 addition & 1 deletion ckan/i18n/cs_CZ/LC_MESSAGES/ckan.po
Expand Up @@ -10,7 +10,7 @@ msgstr ""
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2016-10-18 10:37+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Adrià Mercader <amercadero@gmail.com>, 2016\n"
"Last-Translator: Adrià Mercader <adria.mercader@okfn.org>, 2016\n"
"Language-Team: Czech (Czech Republic) (https://www.transifex.com/okfn/teams/11162/cs_CZ/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
Expand Down
Binary file modified ckan/i18n/da_DK/LC_MESSAGES/ckan.mo
Binary file not shown.
2 changes: 1 addition & 1 deletion ckan/i18n/da_DK/LC_MESSAGES/ckan.po
Expand Up @@ -10,7 +10,7 @@ msgstr ""
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2016-10-18 10:37+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Adrià Mercader <amercadero@gmail.com>, 2016\n"
"Last-Translator: Adrià Mercader <adria.mercader@okfn.org>, 2016\n"
"Language-Team: Danish (Denmark) (https://www.transifex.com/okfn/teams/11162/da_DK/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
Expand Down
Binary file modified ckan/i18n/el/LC_MESSAGES/ckan.mo
Binary file not shown.

0 comments on commit 6e11e61

Please sign in to comment.