[yum-git] Branch 'yum-3_2_X' - 2 commits - output.py yum/comps.py

Seth Vidal skvidal at linux.duke.edu
Fri Jul 18 18:29:21 UTC 2008


 output.py    |    2 +-
 yum/comps.py |   27 +++++++++++++++------------
 2 files changed, 16 insertions(+), 13 deletions(-)

New commits:
commit 12f52e04ea8ce09af3e0b0b4a9551c5b97ebbd06
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Fri Jul 18 14:27:00 2008 -0400

    - add add_group and add_category methods to comps object
    - add a \n to make xml() output look better

diff --git a/yum/comps.py b/yum/comps.py
index 1dc303e..5d257cf 100755
--- a/yum/comps.py
+++ b/yum/comps.py
@@ -423,7 +423,19 @@ class Comps(object):
 
         return returns.values()
 
+    def add_group(self, group):
+        if self._groups.has_key(group.groupid):
+            thatgroup = self._groups[group.groupid]
+            thatgroup.add(group)
+        else:
+            self._groups[group.groupid] = group
 
+    def add_category(self, category):
+        if self._categories.has_key(category.categoryid):
+            thatcat = self._categories[category.categoryid]
+            thatcat.add(category)
+        else:
+            self._categories[category.categoryid] = category
 
     def add(self, srcfile = None):
         if not srcfile:
@@ -444,19 +456,10 @@ class Comps(object):
             for event, elem in parser:
                 if elem.tag == "group":
                     group = Group(elem)
-                    if self._groups.has_key(group.groupid):
-                        thatgroup = self._groups[group.groupid]
-                        thatgroup.add(group)
-                    else:
-                        self._groups[group.groupid] = group
-
+                    self.add_group(group)
                 if elem.tag == "category":
                     category = Category(elem)
-                    if self._categories.has_key(category.categoryid):
-                        thatcat = self._categories[category.categoryid]
-                        thatcat.add(category)
-                    else:
-                        self._categories[category.categoryid] = category
+                    self.add_category(category)
         except SyntaxError, e:
             raise CompsException, "comps file is empty/damaged"
             del parser
@@ -511,7 +514,7 @@ class Comps(object):
         for c in self.get_categories():
             msg += c.xml()
 
-        msg += """</comps>\n"""
+        msg += """\n</comps>\n"""
         
         return msg
             
commit b966c618b09392ee0143dfacac067020b596483e
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Fri Jul 18 14:26:32 2008 -0400

    fix unicode traceback due to str() call on exception which was already unicode :(

diff --git a/output.py b/output.py
index 6d9006d..283bf85 100644
--- a/output.py
+++ b/output.py
@@ -236,7 +236,7 @@ class YumOutput:
     def failureReport(self, errobj):
         """failure output for failovers from urlgrabber"""
         
-        self.logger.error('%s: %s', errobj.url, str(errobj.exception))
+        self.logger.error('%s: %s', errobj.url, errobj.exception)
         self.logger.error(_('Trying other mirror.'))
         raise errobj.exception
     



More information about the Yum-cvs-commits mailing list