From 980f6b90fe2ad4b4ec95d13bb6472bb949b215b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Mon, 2 Mar 2009 21:49:22 +0100 Subject: Fixed interactive search with category names --- portato/db/sql.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'portato/db/sql.py') diff --git a/portato/db/sql.py b/portato/db/sql.py index cb252c1..b794d08 100644 --- a/portato/db/sql.py +++ b/portato/db/sql.py @@ -248,6 +248,11 @@ class SQLDatabase (Database): self._restrict = "" else: restrict = restrict.replace(".*","%").replace(".","_") - self._restrict = "AND name LIKE '%%%s%%'" % restrict + + if "/" in restrict: + cat,pkg = restrict.split("/") + self._restrict = "AND name LIKE '%%%s%%' AND cat LIKE '%s'" % (pkg, cat) + else: + self._restrict = "AND (name LIKE '%%%(restrict)s%%' OR cat LIKE '%(restrict)s%%')" % {"restrict":restrict} restrict = property(get_restrict, set_restrict) -- cgit v1.2.3