From: Michael Tremer Date: Fri, 6 Oct 2017 16:06:28 +0000 (+0100) Subject: arches: Base Arch class on DataObject X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0257f2d6da7e9059c4d0ff305dc69357a4de27cd;p=pbs.git arches: Base Arch class on DataObject Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/arches.py b/src/buildservice/arches.py index 1b4d6235..2ec4b202 100644 --- a/src/buildservice/arches.py +++ b/src/buildservice/arches.py @@ -62,27 +62,12 @@ class Arches(base.Object): return sorted([self.get_by_id(a.id) for a in self.db.query(query, *args)]) -class Arch(base.Object): - def __init__(self, pakfire, id, data=None): - base.Object.__init__(self, pakfire) - - # The ID of this architecture. - self.id = id - - # Cache data. - self._data = data +class Arch(base.DataObject): + table = "arches" def __cmp__(self, other): return cmp(self.prio, other.prio) - @property - def data(self): - if self._data is None: - self._data = self.db.get("SELECT * FROM arches WHERE id = %s", self.id) - assert self._data - - return self._data - @property def name(self): return self.data.name