From 804a7c412daa68988163c3f667fc37d5fe0860c4 Mon Sep 17 00:00:00 2001 From: David Read Date: Wed, 16 May 2012 15:00:25 +0100 Subject: [PATCH] [#2373] Added back in search_by_name method for backwards compatibility. --- ckan/model/group.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ckan/model/group.py b/ckan/model/group.py index 79eacf5768c..3b14f97e1ba 100644 --- a/ckan/model/group.py +++ b/ckan/model/group.py @@ -191,6 +191,15 @@ def search_by_name_or_title(cls, text_query, group_type=None): q = q.filter(cls.type==group_type) return q.order_by(cls.title) + @classmethod + def search_by_name(cls, text_query, group_type=None): + # deprecated - not used + text_query = text_query.strip().lower() + if not group_type: + q = Session.query(cls).filter(cls.name.contains(text_query)) + else: + q = Session.query(cls).filter(cls.name.contains(text_query)).filter(cls.type==group_type) + def as_dict(self, ref_package_by='name'): _dict = DomainObject.as_dict(self) _dict['packages'] = [getattr(package, ref_package_by) for package in self.packages]