add exception GroupNotFound

This commit is contained in:
Faik Uygur
2009-06-18 07:00:38 +00:00
parent af5e8957ec
commit a672a51c03
+5 -2
View File
@@ -20,6 +20,9 @@ import pisi.db.itembyrepo
import pisi.group
import pisi.db.lazydb as lazydb
class GroupNotFound(Exception):
pass
class GroupDB(lazydb.LazyDB):
def __init__(self):
@@ -60,7 +63,7 @@ class GroupDB(lazydb.LazyDB):
def get_group(self, name, repo = None):
if not self.has_group(name, repo):
raise Exception(_('Group %s not found') % name)
raise GroupNotFound(_('Group %s not found') % name)
group = pisi.group.Group()
group.parse(self.gdb.get_item(name, repo))
@@ -69,7 +72,7 @@ class GroupDB(lazydb.LazyDB):
def get_group_components(self, name, repo=None):
if not self.has_group(name, repo):
raise Exception(_('Group %s not found') % name)
raise GroupNotFound(_('Group %s not found') % name)
if self.gcdb.has_item(name):
return self.gcdb.get_item(name, repo)