[csw-devel] SF.net SVN: gar:[20340] csw/mgar/gar/v2/lib/python

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Tue Feb 26 12:41:07 CET 2013


Revision: 20340
          http://gar.svn.sourceforge.net/gar/?rev=20340&view=rev
Author:   wahwah
Date:     2013-02-26 11:41:07 +0000 (Tue, 26 Feb 2013)
Log Message:
-----------
pkgdb: Various cleanup changes

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/package_stats.py
    csw/mgar/gar/v2/lib/python/pkgdb.py

Modified: csw/mgar/gar/v2/lib/python/package_stats.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_stats.py	2013-02-26 11:40:53 UTC (rev 20339)
+++ csw/mgar/gar/v2/lib/python/package_stats.py	2013-02-26 11:41:07 UTC (rev 20340)
@@ -88,7 +88,7 @@
       res = m.Srv4FileStats.select(m.Srv4FileStats.q.md5_sum==md5_sum)
       try:
         self.db_pkg_stats = res.getOne()
-      except sqlobject.SQLObjectNotFound, e:
+      except sqlobject.SQLObjectNotFound as e:
         logging.debug(u"GetDbObject(): %s not found", md5_sum)
         return None
       logging.debug(u"GetDbObject(): %s succeeded", md5_sum)
@@ -138,7 +138,7 @@
     """
     try:
       os.makedirs(dir_path)
-    except OSError, e:
+    except OSError as e:
       if e.errno == errno.EEXIST:
         pass
       else:
@@ -225,7 +225,7 @@
   def GetOrSetPkginst(cls, pkgname):
     try:
       pkginst = m.Pkginst.select(m.Pkginst.q.pkgname==pkgname).getOne()
-    except sqlobject.main.SQLObjectNotFound, e:
+    except sqlobject.main.SQLObjectNotFound as e:
       logging.debug(e)
       pkginst = m.Pkginst(pkgname=pkgname)
     return pkginst
@@ -234,7 +234,7 @@
   def SaveStats(cls, pkg_stats, register=False):
     """Saves a data structure to the database.
 
-    Does not require an instance.
+    Does not require an instance of the class.
     """
     logging.debug("SaveStats()")
     pkgname = pkg_stats["basic_stats"]["pkgname"]
@@ -244,7 +244,7 @@
       res = m.Architecture.select(
           m.Architecture.q.name==pkg_stats["pkginfo"]["ARCH"])
       arch = res.getOne()
-    except sqlobject.main.SQLObjectNotFound, e:
+    except sqlobject.main.SQLObjectNotFound as e:
       logging.debug(e)
       arch = m.Architecture(name=pkg_stats["pkginfo"]["ARCH"])
     try:
@@ -252,7 +252,7 @@
           m.Architecture.q.name
             ==
           pkg_stats["basic_stats"]["parsed_basename"]["arch"]).getOne()
-    except sqlobject.main.SQLObjectNotFound, e:
+    except sqlobject.main.SQLObjectNotFound as e:
       filename_arch = m.Architecture(
           name=pkg_stats["basic_stats"]["parsed_basename"]["arch"])
     basename = pkg_stats["basic_stats"]["parsed_basename"]
@@ -261,14 +261,14 @@
     try:
       os_rel = m.OsRelease.select(
           m.OsRelease.q.short_name==os_rel_name).getOne()
-    except sqlobject.main.SQLObjectNotFound, e:
+    except sqlobject.main.SQLObjectNotFound as e:
       logging.debug(e)
       os_rel = m.OsRelease(short_name=os_rel_name, full_name=os_rel_name)
     try:
       maint_email = pkg_stats["pkginfo"]["EMAIL"]
       maintainer = m.Maintainer.select(
           m.Maintainer.q.email==maint_email).getOne()
-    except sqlobject.main.SQLObjectNotFound, e:
+    except sqlobject.main.SQLObjectNotFound as e:
       logging.debug(e)
       maintainer = m.Maintainer(email=maint_email)
 
@@ -293,7 +293,7 @@
       db_pkg_stats = m.Srv4FileStats.selectBy(md5_sum=md5_sum).getOne()
       logging.debug("Cleaning %s before saving it again", db_pkg_stats)
       db_pkg_stats.DeleteAllDependentObjects()
-    except sqlobject.main.SQLObjectNotFound, e:
+    except sqlobject.main.SQLObjectNotFound as e:
       logging.debug("Package %s not present in the db, proceeding with insert.",
                     basename)
       pass
@@ -344,7 +344,7 @@
           version_string=parsed_basename["full_version_string"])
     # Inserting overrides as rows into the database
     for override_dict in pkg_stats["overrides"]:
-      o = m.CheckpkgOverride(srv4_file=db_pkg_stats,
+      m.CheckpkgOverride(srv4_file=db_pkg_stats,
                              **override_dict)
     return db_pkg_stats
 
@@ -360,7 +360,7 @@
     try:
       stats = m.Srv4FileStats.select(
          m.Srv4FileStats.q.md5_sum==md5_sum).getOne()
-    except sqlobject.SQLObjectNotFound, e:
+    except sqlobject.SQLObjectNotFound as e:
       stats = cls.SaveStats(pkg_stats, register=False)
     if stats.registered and not replace:
       logging.debug(

Modified: csw/mgar/gar/v2/lib/python/pkgdb.py
===================================================================
--- csw/mgar/gar/v2/lib/python/pkgdb.py	2013-02-26 11:40:53 UTC (rev 20339)
+++ csw/mgar/gar/v2/lib/python/pkgdb.py	2013-02-26 11:41:07 UTC (rev 20340)
@@ -393,7 +393,7 @@
   else:
     logging.basicConfig(level=logging.INFO)
   if not args:
-    raise UsageError("Please specify a command.  Se --help.")
+    raise UsageError("Please specify a command.  See --help.")
   # SetUpSqlobjectConnection needs to be called after
   # logging.basicConfig
   configuration.SetUpSqlobjectConnection()

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list