Skip to content

Commit

Permalink
[#2373] Added back in search_by_name method for backwards compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Read authored and amercader committed May 23, 2012
1 parent cd5caba commit 5ec65fa
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ckan/model/group.py
Expand Up @@ -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]
Expand Down

0 comments on commit 5ec65fa

Please sign in to comment.