Skip to content

Commit

Permalink
Merge tag 'ckan-2.8.8' into 2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed May 18, 2021
2 parents 1e10689 + e510533 commit 7567762
Show file tree
Hide file tree
Showing 40 changed files with 1,094 additions and 158 deletions.
2 changes: 2 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ type = PO
# Transifex vs Babel (& CKAN)
# 'sr@Latin' vs 'sr_Latn'
trans.sr@latin = ckan/i18n/sr_Latn/LC_MESSAGES/ckan.po
trans.zh_CN = ckan/i18n/zh_Hans_CN/LC_MESSAGES/ckan.po
trans.zh_TW = ckan/i18n/zh_Hant_TW/LC_MESSAGES/ckan.po
20 changes: 20 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@
Changelog
---------


v.2.8.8 2021-05-19
==================

* Fix Chinese locales (`#4413 <https://github.com/ckan/ckan/pull/4413>`_)
* Allow installation of requirements without any additional actions using pip (`#5408 <https://github.com/ckan/ckan/pull/5408>`_)
* Include requirements files in Manifest (`#5726 <https://github.com/ckan/ckan/pull/5726>`_)
* Dockerfile: pin pip version (`#5929 <https://github.com/ckan/ckan/pull/5929>`_)
* Allow uploaders to only override asset / resource uploading (`#6088 <https://github.com/ckan/ckan/pull/6088>`_)
* Catch TypeError from invalid thrown by dateutils (`#6085 <https://github.com/ckan/ckan/pull/6085>`_)
* Display proper message when sysadmin password is incorect (`#5911 <https://github.com/ckan/ckan/pull/5911>`_)
* Use external library to parse view filter params
* Fix auth error when deleting a group/org (`#6006 <https://github.com/ckan/ckan/pull/6006>`_)
* Fix datastore_search language parameter (`#5974 <https://github.com/ckan/ckan/pull/5974>`_)
* make SQL function whitelist case-insensitive unless quoted (`#5969 <https://github.com/ckan/ckan/pull/5969>`_)
* Fix Explore button not working (`#3720 <https://github.com/ckan/ckan/pull/3720>`_)
* remove unused var in task_status_update (`#5861 <https://github.com/ckan/ckan/pull/5861>`_)
* Prevent guessing format and mimetype from resource urls without path (`#5852 <https://github.com/ckan/ckan/pull/5852>`_)


v.2.8.7 2021-02-10
==================

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ RUN mkdir -p $CKAN_VENV $CKAN_CONFIG $CKAN_STORAGE_PATH && \

# Setup CKAN
ADD . $CKAN_VENV/src/ckan/
RUN ckan-pip install -U pip && \
RUN ckan-pip install -U 'pip<21' && \
ckan-pip install --upgrade --no-cache-dir -r $CKAN_VENV/src/ckan/requirement-setuptools.txt && \
ckan-pip install --upgrade --no-cache-dir -r $CKAN_VENV/src/ckan/requirements.txt && \
ckan-pip install -e $CKAN_VENV/src/ckan/ && \
Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ include ckan/migration/migrate.cfg
include ckan/migration/README
recursive-include ckan/migration/versions *.sql
include requirement-setuptools.txt
include requirements.txt
include requirements-py2.txt
include dev-requirements.txt
2 changes: 1 addition & 1 deletion ckan/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8

__version__ = '2.8.7'
__version__ = '2.8.8'

__description__ = 'CKAN Software'
__long_description__ = \
Expand Down
2 changes: 1 addition & 1 deletion ckan/controllers/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ def delete(self, id):
except NotAuthorized:
abort(403, _('Unauthorized to delete group %s') % '')

c.group_dict = self._action('group_show')(context, {'id': id})
try:
if request.method == 'POST':
self._action('group_delete')(context, {'id': id})
Expand All @@ -626,7 +627,6 @@ def delete(self, id):
h.flash_notice(_('%s has been deleted.')
% _(group_type.capitalize()))
h.redirect_to(group_type + '_index')
c.group_dict = self._action('group_show')(context, {'id': id})
except NotAuthorized:
abort(403, _('Unauthorized to delete group %s') % '')
except NotFound:
Expand Down
Binary file modified ckan/i18n/cs_CZ/LC_MESSAGES/ckan.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions ckan/i18n/cs_CZ/LC_MESSAGES/ckan.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Translators:
# Jakub Klímek <klimek@ksi.mff.cuni.cz>, 2018
# Adrià Mercader <adria.mercader@okfn.org>, 2018
# Jiří Podhorecký, 2020
# trendspotter, 2020
#
#, fuzzy
msgid ""
Expand All @@ -15,7 +15,7 @@ msgstr ""
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2020-03-31 17:05+0200\n"
"PO-Revision-Date: 2018-03-27 14:15+0000\n"
"Last-Translator: Jiří Podhorecký, 2020\n"
"Last-Translator: trendspotter, 2020\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/mk/LC_MESSAGES/ckan.mo
Binary file not shown.
6 changes: 3 additions & 3 deletions ckan/i18n/mk/LC_MESSAGES/ckan.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Translators:
# Adrià Mercader <adria.mercader@okfn.org>, 2018
# Aleksandar Jovanov <ace92bt@gmail.com>, 2018
# Konstantin Sivakov <konstantin.sivakov@gmail.com>, 2018
# Konstantin Sivakov <konstantin.sivakov@gmail.com>, 2021
#
#, fuzzy
msgid ""
Expand All @@ -15,7 +15,7 @@ msgstr ""
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2020-03-31 17:05+0200\n"
"PO-Revision-Date: 2018-03-27 14:15+0000\n"
"Last-Translator: Konstantin Sivakov <konstantin.sivakov@gmail.com>, 2018\n"
"Last-Translator: Konstantin Sivakov <konstantin.sivakov@gmail.com>, 2021\n"
"Language-Team: Macedonian (https://www.transifex.com/okfn/teams/11162/mk/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -3728,7 +3728,7 @@ msgstr "Електронска пошта на одржувач"

#: ckan/templates/package/snippets/resource_edit_form.html:12
msgid "Update Resource"
msgstr "Ажурирајње на ресурс"
msgstr "Ажурирање на ресурс"

#: ckan/templates/package/snippets/resource_form.html:26
msgid "Data"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion ckan/lib/search/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ def index_package(self, pkg_dict, defer_commit=False):
# The date field was empty, so dateutil filled it with
# the default bogus date
value = None
except (ValueError, IndexError):
except (IndexError, TypeError, ValueError):
log.error('%r: %r value of %r is not a valid date', pkg_dict['id'], key, value)
continue
new_dict[key] = value
pkg_dict = new_dict
Expand Down
7 changes: 6 additions & 1 deletion ckan/lib/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import logging
import magic
import mimetypes
from six.moves.urllib.parse import urlparse

from werkzeug.datastructures import FileStorage as FlaskFileStorage

Expand Down Expand Up @@ -51,6 +52,8 @@ def get_uploader(upload_to, old_filename=None):
upload = None
for plugin in plugins.PluginImplementations(plugins.IUploader):
upload = plugin.get_uploader(upload_to, old_filename)
if upload:
break

# default uploader
if upload is None:
Expand All @@ -64,6 +67,8 @@ def get_resource_uploader(data_dict):
upload = None
for plugin in plugins.PluginImplementations(plugins.IUploader):
upload = plugin.get_resource_uploader(data_dict)
if upload:
break

# default uploader
if upload is None:
Expand Down Expand Up @@ -221,7 +226,7 @@ def __init__(self, resource):
upload_field_storage = resource.pop('upload', None)
self.clear = resource.pop('clear_upload', None)

if config_mimetype_guess == 'file_ext':
if url and config_mimetype_guess == 'file_ext' and urlparse(url).path:
self.mimetype = mimetypes.guess_type(url)[0]

if isinstance(upload_field_storage, ALLOWED_UPLOAD_TYPES):
Expand Down
1 change: 0 additions & 1 deletion ckan/logic/action/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,6 @@ def task_status_update(context, data_dict):
session = model.meta.create_local_session()
context['session'] = session

user = context['user']
id = data_dict.get("id")
schema = context.get('schema') or schema_.default_task_status_schema()

Expand Down
8 changes: 8 additions & 0 deletions ckan/logic/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,14 @@ def if_empty_guess_format(key, data, errors, context):
# if resource_id then an update
if (not value or value is Missing) and not resource_id:
url = data.get(key[:-1] + ('url',), '')
if not url:
return

# Uploaded files have only the filename as url, so check scheme to determine if it's an actual url
parsed = urlparse(url)
if parsed.scheme and not parsed.path:
return

mimetype, encoding = mimetypes.guess_type(url)
if mimetype:
data[key] = mimetype
Expand Down
1 change: 1 addition & 0 deletions ckan/public-bs2/base/vendor/resource.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ vendor =
moment-with-locales.js
select2/select2.js
select2/select2.css
qs.js

bootstrap =
bootstrap/js/bootstrap.js
Expand Down
85 changes: 2 additions & 83 deletions ckan/public/base/javascript/view-filters.js
Original file line number Diff line number Diff line change
@@ -1,84 +1,3 @@
/**
* Return a new JSON object of the old string.
* Turns:
* file.js?a=1&amp;b.c=3.0&b.d=four&a_false_value=false&a_null_value=null
* Into:
* {"a":1,"b":{"c":3,"d":"four"},"a_false_value":false,"a_null_value":null}
* @version 1.1.0
* @date July 16, 2010
* @since 1.0.0, June 30, 2010
* @package jquery-sparkle {@link http://balupton.com/projects/jquery-sparkle}
* @author Benjamin "balupton" Lupton {@link http://balupton.com}
* @copyright (c) 2009-2010 Benjamin Arthur Lupton {@link http://balupton.com}
* @license MIT License {@link http://creativecommons.org/licenses/MIT/}
*/
String.prototype.queryStringToJSON = String.prototype.queryStringToJSON || function ( )
{ // Turns a params string or url into an array of params
// Prepare
var params = String(this);
// Remove url if need be
params = params.substring(params.indexOf('?')+1);
// params = params.substring(params.indexOf('#')+1);
// Change + to %20, the %20 is fixed up later with the decode
params = params.replace(/\+/g, '%20');
// Do we have JSON string?
try {
return JSON.parse(decodeURIComponent(params));
} catch(error) {
// We have a params string
params = params.split(/\&(amp\;)?/);
}
var json = {};
// We have params
for ( var i = 0, n = params.length; i < n; ++i )
{
// Adjust
var param = params[i] || null;
if ( param === null ) { continue; }
param = param.split('=');
if ( param === null ) { continue; }
// ^ We now have "var=blah" into ["var","blah"]

// Get
var key = param[0] || null;
if ( key === null ) { continue; }
if ( typeof param[1] === 'undefined' ) { continue; }
var value = param[1];
// ^ We now have the parts

// Fix
key = decodeURIComponent(key);
value = decodeURIComponent(value);

// Set
var keys = key.split('.');
if ( keys.length === 1 )
{ // Simple
json[key] = value;
}
else
{ // Advanced (Recreating an object)
// eg ?a.b.c=test -> {"a": {"b": {"c": "test}}}

var setNestedKey = function(obj, path, value) {
if (path.length === 1) {
obj[path] = value
return
}
if (typeof obj[path[0]] === 'undefined') {
obj[path[0]] = {}
}
return setNestedKey(obj[path[0]], path.slice(1), value)
}

setNestedKey(json, keys, value);

}
// ^ We now have the parts added to your JSON object
}
return json;
};

this.ckan = this.ckan || {};
this.ckan.views = this.ckan.views || {};

Expand Down Expand Up @@ -153,7 +72,7 @@ this.ckan.views.filters = (function (queryString) {
function _redirectTo(url) {
var urlBase = url.split('?')[0],
urlQueryString = url.split('?')[1] || '',
defaultParams = urlQueryString.queryStringToJSON(),
defaultParams = Qs.parse(urlQueryString, { ignoreQueryPrefix: true }),
queryString = _encodedParams(defaultParams),
destinationUrl;

Expand Down Expand Up @@ -205,7 +124,7 @@ this.ckan.views.filters = (function (queryString) {

function _initialize(queryString) {
// The filters are in format 'field:value|field:value|field:value'
var searchParams = queryString.queryStringToJSON();
var searchParams = Qs.parse(queryString, { ignoreQueryPrefix: true });

if (searchParams.filters) {
var filters = {},
Expand Down
21 changes: 3 additions & 18 deletions ckan/public/base/javascript/view-filters.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7567762

Please sign in to comment.