From cf06e6f15bcc640ce063f2a8d07280050ac7136a Mon Sep 17 00:00:00 2001 From: Ian Ward Date: Mon, 27 Jul 2015 15:59:15 -0400 Subject: [PATCH] just use unicode in _parse_sort_clause --- ckanext/datastore/plugin.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ckanext/datastore/plugin.py b/ckanext/datastore/plugin.py index ba72d5953bb..aae608e0b89 100644 --- a/ckanext/datastore/plugin.py +++ b/ckanext/datastore/plugin.py @@ -1,6 +1,5 @@ import sys import logging -import shlex import re import pylons @@ -350,16 +349,14 @@ def datastore_validate(self, context, data_dict, fields_types): return data_dict def _parse_sort_clause(self, clause, fields_types): - clause = ' '.join(shlex.split(clause.encode('utf-8'))) - clause_match = re.match('^(.+?)( +(asc|desc) *)?$', clause, re.I) + clause_match = re.match(u'^(.+?)( +(asc|desc) *)?$', clause, re.I) if not clause_match: return False field = clause_match.group(1) - sort = (clause_match.group(3) or 'asc').lower() + sort = (clause_match.group(3) or u'asc').lower() - field, sort = unicode(field, 'utf-8'), unicode(sort, 'utf-8') if field not in fields_types: return False