]> git.ipfire.org Git - people/jschlag/pbs.git/commitdiff
arches: Base Arch class on DataObject
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 6 Oct 2017 16:06:28 +0000 (17:06 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 6 Oct 2017 16:06:28 +0000 (17:06 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/arches.py

index 1b4d623556ab6afd344f6d42c204ed1202f12672..2ec4b2029db225086496f303299e84a861da0a65 100644 (file)
@@ -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