From b41490a6f6d19c70d67384cafc342bb7f106b91d Mon Sep 17 00:00:00 2001 From: Massimo Date: Tue, 2 Oct 2012 14:50:16 -0500 Subject: [PATCH] wiki uses contains instead of startswith, thanks David --- VERSION | 2 +- gluon/dal.py | 4 +++- gluon/tools.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 9ba4d665..90a3f2e3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.0.9 (2012-10-01 21:16:35) dev +Version 2.0.9 (2012-10-02 14:50:06) dev diff --git a/gluon/dal.py b/gluon/dal.py index bd6ecf31..b98394cc 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -3267,7 +3267,9 @@ class FireBirdAdapter(BaseAdapter): return 'SUBSTRING(%s from %s for %s)' % (self.expand(field), parameters[0], parameters[1]) def CONTAINS(self, first, second): - if first.type.startswith('list:'): + if first.type in ('string','text'): + key = str(second).replace('%','%%') + elif first.type.startswith('list:'): key = '|'+str(second).replace('|','||').replace('%','%%')+'|' return '(%s CONTAINING %s)' % (self.expand(first), self.expand(key,'string')) diff --git a/gluon/tools.py b/gluon/tools.py index 3d4141c1..34cfdd3d 100644 --- a/gluon/tools.py +++ b/gluon/tools.py @@ -4921,7 +4921,7 @@ class Wiki(object): if query is None: query = (db.wiki_page.id==db.wiki_tag.wiki_page)&\ (db.wiki_tag.name.belongs(tags)) - query = query|db.wiki_page.title.startswith(request.vars.q) + query = query|db.wiki_page.title.contains(request.vars.q) if self.restrict_search and not self.manage(): query = query&(db.wiki_page.created_by==self.auth.user_id) pages = db(query).select(count,