[ckan-changes] commit/ckan: kindly: [search] fixed error when licence used in query string
Bitbucket
commits-noreply at bitbucket.org
Fri Jun 17 21:03:12 UTC 2011
1 new changeset in ckan:
http://bitbucket.org/okfn/ckan/changeset/a106f9d88ee5/
changeset: a106f9d88ee5
branch: feature-1141-moderated-edits-ajax
user: kindly
date: 2011-06-17 20:01:16
summary: [search] fixed error when licence used in query string
affected #: 2 files (269 bytes)
--- a/ckan/lib/search/sql.py Thu Jun 16 17:50:05 2011 +0100
+++ b/ckan/lib/search/sql.py Fri Jun 17 19:01:16 2011 +0100
@@ -142,7 +142,7 @@
if isinstance(terms, basestring):
terms = terms.split()
- if hasattr(model.Package, field):
+ if field in model.package_table.c:
model_attr = getattr(model.Package, field)
for term in terms:
q = q.filter(make_like(model_attr, term))
--- a/ckan/tests/lib/test_package_search.py Thu Jun 16 17:50:05 2011 +0100
+++ b/ckan/tests/lib/test_package_search.py Fri Jun 17 19:01:16 2011 +0100
@@ -99,6 +99,11 @@
result = self.backend.query_for(model.Package).run(query=u'Expenditure Government China')
assert len(result['results']) == 0, self._pkg_names(result)
+ def test_3_licence(self):
+ ## this should result, but it is here to check that at least it does not error
+ result = self.backend.query_for(model.Package).run(query=u'license:"OKD::Other (PublicsDomain)"')
+ assert result['count'] == 0, result
+
# Quotation not supported now
## # multiple words quoted
## result = Search().search(u'"Government Expenditure"')
Repository URL: https://bitbucket.org/okfn/ckan/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the ckan-changes
mailing list