diff options
author | Marcin Kuzminski <marcin@python-works.com> | 2012-12-07 01:04:17 +0100 |
---|---|---|
committer | Marcin Kuzminski <marcin@python-works.com> | 2012-12-07 01:04:17 +0100 |
commit | e28d3cfaa47621cb72227a4601917106df3857eb (patch) | |
tree | 500737242e6f5cfbd9b7293fbead36a9549d62ee /rhodecode/controllers | |
parent | 01055a67d1840422ba10f0718b363518c30ba96a (diff) |
fixed tests, made the journal filter consistent accross different databases
--HG--
branch : beta
Diffstat (limited to 'rhodecode/controllers')
-rw-r--r-- | rhodecode/controllers/admin/admin.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/rhodecode/controllers/admin/admin.py b/rhodecode/controllers/admin/admin.py index 32444fbb..9e3b07eb 100644 --- a/rhodecode/controllers/admin/admin.py +++ b/rhodecode/controllers/admin/admin.py @@ -30,7 +30,7 @@ from sqlalchemy.orm import joinedload from webhelpers.paginate import Page from whoosh.qparser.default import QueryParser from whoosh import query -from sqlalchemy.sql.expression import or_, and_ +from sqlalchemy.sql.expression import or_, and_, func from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator from rhodecode.lib.base import BaseController, render @@ -63,12 +63,12 @@ def _journal_filter(user_log, search_term): if wc_term.startswith('*') and not wc_term.endswith('*'): #postfix == endswith wc_term = remove_prefix(wc_term, prefix='*') - return getattr(col, 'endswith')(wc_term) + return func.lower(col).endswith(wc_term) elif wc_term.startswith('*') and wc_term.endswith('*'): #wildcard == ilike wc_term = remove_prefix(wc_term, prefix='*') wc_term = remove_suffix(wc_term, suffix='*') - return getattr(col, 'contains')(wc_term) + return func.lower(col).contains(wc_term) def get_filterion(field, val, term): @@ -88,10 +88,10 @@ def _journal_filter(user_log, search_term): if isinstance(term, query.Wildcard): return wildcard_handler(field, val) elif isinstance(term, query.Prefix): - return field.startswith(val) + return func.lower(field).startswith(func.lower(val)) elif isinstance(term, query.DateRange): return and_(field >= val[0], field <= val[1]) - return field == val + return func.lower(field) == func.lower(val) if isinstance(qry, (query.And, query.Term, query.Prefix, query.Wildcard, query.DateRange)): |