diff options
Diffstat (limited to 'portato')
-rw-r--r-- | portato/db/dict.py | 2 | ||||
-rw-r--r-- | portato/db/sql.py | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/portato/db/dict.py b/portato/db/dict.py index f6edea6..4992df6 100644 --- a/portato/db/dict.py +++ b/portato/db/dict.py @@ -86,7 +86,7 @@ class DictDatabase (Database): try: if self.restrict: - return (pkg for pkg in get_pkgs() if self.restrict.search(pkg.pkg))#if pkg[1].find(self.restrict) != -1) + return (pkg for pkg in get_pkgs() if self.restrict.search(pkg.cat+"/"+pkg.pkg)) else: return get_pkgs() 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) |