[yum-git] yum/packages.py yum/sqlitesack.py

Tim Lauridsen timlau at linux.duke.edu
Mon Feb 4 09:21:28 UTC 2008


 yum/packages.py   |    8 ++++----
 yum/sqlitesack.py |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 9ffe1c382582d2f90550b68df7f458ea8abae278
Author: Tim Lauridsen <tla at rasmil.dk>
Date:   Mon Feb 4 10:16:24 2008 +0100

    Use the real Classname for package object information, moved the __repr__ to PackageObject so child classes has some useful object info

diff --git a/yum/packages.py b/yum/packages.py
index a665eb6..a5c1bbf 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -191,6 +191,9 @@ class PackageObject(object):
             ret = cmp(self.arch, other.arch)
         return ret
 
+    def __repr__(self):
+        return "<%s : %s>" % (self.__class__.__name__, str(self)) 
+
     def returnSimple(self, varname):
         warnings.warn("returnSimple() will go away in a future version of Yum.\n",
                       Errors.YumFutureDeprecationWarning, stacklevel=2)
@@ -821,10 +824,7 @@ class YumInstalledPackage(YumHeaderPackage):
     def __init__(self, hdr):
         fakerepo = _installed_repo
         YumHeaderPackage.__init__(self, fakerepo, hdr)
-
-    def __repr__(self):
-        return "<Installed Package : %s >" % (str(self))
-
+        
     def verify(self, patterns=[]):
         """verify that the installed files match the packaged checksum
            optionally verify they match only if they are in the 'pattern' list
diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index 474f642..1e737b6 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -71,7 +71,7 @@ class YumAvailablePackageSqlite(YumAvailablePackage, PackageObject, RpmBase):
 
     def __repr__(self):
         h = hex(hash(self.pkgid + self.repo.id + str(self)))
-        return "<Available Package : %s (%s) %s >" % (str(self),self.repo.id,h)
+        return "<%s : %s (%s) %s>" % (self.__class__.__name__,str(self),self.repo.id,h)
         
     def _read_db_obj(self, db_obj, item=None):
         """read the db obj. If asked for a specific item, return it.



More information about the Yum-cvs-commits mailing list