[Blends-commit] [SCM] website branch, master, updated. 060905806fcefb5d226e520f94f3eb6f205522e2

Ole Streicher olebole at debian.org
Tue Mar 8 22:19:08 UTC 2016


The following commit has been merged in the master branch:
commit db3dd86855af8a151dbbf233aa36f4b3f0e4328f
Author: Ole Streicher <olebole at debian.org>
Date:   Tue Mar 8 23:16:37 2016 +0100

    Fix except statemets: 'except X, x' --> 'except X as x'

diff --git a/webtools/blendsmarkdown.py b/webtools/blendsmarkdown.py
index 6cdca26..2023dfc 100644
--- a/webtools/blendsmarkdown.py
+++ b/webtools/blendsmarkdown.py
@@ -104,17 +104,17 @@ def MarkupString(string, pkg, elem, lang='en'):
         return None
     try:
         string = Markup(string)
-    except UnicodeDecodeError, errtxt:
-        stderr.write("----> %s UnicodeDecodeError in %s (lang='%s'): '%s'; ErrTxt: %s\n"
-                     % (elem, pkg, lang, 'debug-string', errtxt))
+    except UnicodeDecodeError as err:
+        stderr.write("----> %s UnicodeDecodeError in %s (lang='%s'): '%s'; Err: %s\n"
+                     % (elem, pkg, lang, 'debug-string', str(err)))
         try:
             string = Markup(unicode(string, 'utf-8'))
-        except TypeError, errtxt:
-            stderr.write("====> %s TypeError in %s (lang='%s'): '%s'; ErrTxt: %s\n"
-                         % (elem, pkg, lang, 'debug-string', errtxt))
-    except TypeError, errtxt:
-        stderr.write("----> %s TypeError in %s (lang='%s'): '%s'; ErrTxt: %s\n"
-                     % (elem, pkg, lang, 'debug-string', errtxt))
+        except TypeError as err:
+            stderr.write("====> %s TypeError in %s (lang='%s'): '%s'; Err: %s\n"
+                         % (elem, pkg, lang, 'debug-string', str(err)))
+    except TypeError as err:
+        stderr.write("----> %s TypeError in %s (lang='%s'): '%s'; Err: %s\n"
+                     % (elem, pkg, lang, 'debug-string', str(err)))
     return string
 
 rendering_lib  = ''
diff --git a/webtools/blendstasktools.py b/webtools/blendstasktools.py
index c32eb0d..50a797d 100644
--- a/webtools/blendstasktools.py
+++ b/webtools/blendstasktools.py
@@ -289,10 +289,10 @@ def GetDependencies2Use(dependencystatus=[], max_order='prospective'):
 try:
     conn = psycopg2.connect(host="localhost", port=PORT, user="guest",
                             database="udd")
-except psycopg2.OperationalError, err:
+except psycopg2.OperationalError as err:
     try:
         conn = psycopg2.connect("service=udd")
-    except psycopg2.OperationalError, err:
+    except psycopg2.OperationalError as err:
         # logger not known at this state: logger.warning
         stderr.write("Service=udd seems not to be installed on this host.\tMessage: %s\n" % (str(err)))
         try:
@@ -314,10 +314,10 @@ def _execute_udd_query(query):
     try:
         curs.execute(query)
         logger.debug(query)
-    except psycopg2.ProgrammingError, err:
+    except psycopg2.ProgrammingError as err:
         stderr.write("Problem with query\n%s\n%s\n" % (query, str(err)))
         exit(-1)
-    except psycopg2.DataError, err:
+    except psycopg2.DataError as err:
         stderr.write("%s; query was\n%s\n" % (str(err), query))
 
 query = """PREPARE query_pkgs (text[],text[],text) AS
@@ -1196,7 +1196,7 @@ class TaskDependencies:
                 self.metapkg.desc[lang]['short'] = MarkupString(short, self.metapkg.pkg, 'taskShortDesc', lang)
                 try:
                     self.metapkg.desc[lang]['long'] = Markup(render_longdesc(ddtptranslations['long_description_' + lang].splitlines()))
-                except AttributeError, err:
+                except AttributeError as err:
                     logger.error("===> AttributeError in metapackage long %s (lang='%s'): '%s'; ErrTxt: %s"
                                  % (self.metapkg.pkg, lang, ddtptranslations['long_description_' + lang], err))
                     self.metapkg.desc[lang]['long'] = 'Missing long description'
@@ -1361,7 +1361,7 @@ class TaskDependencies:
                         if dep.properties['vcs-browser'] == HOMEPAGENONE:
                             try:
                                 dep.properties['vcs-browser'] = BrowserFromVcsURL(dep.properties['vcs-type'], dep.properties['vcs-url'])
-                            except KeyError, err:
+                            except KeyError as err:
                                 logger.error("Vcs Property missing in packages file:", dep.properties, err)
                     else:
                         logger.error("Dep not initiated before Vcs-Svn %s -> something is wrong."
@@ -1651,7 +1651,7 @@ class TaskDependencies:
                 if row['changed_by']:
                     try:
                         changed = row['changed_by']
-                    except TypeError, err:
+                    except TypeError as err:
                         changed = None
                         logger.warning("Encoding problem for last uploader of package '%s' in task %s (%s)" % (dep.pkg, dep.taskname, err))
                     if changed:
@@ -1733,7 +1733,7 @@ class TaskDependencies:
                 if row['changed_by']:
                     try:
                         changed = row['changed_by']
-                    except TypeError, err:
+                    except TypeError as err:
                         changed = None
                         logger.warning("Encoding problem for uploader to ftpnew of package '%s' in task %s (%s)" % (dep.pkg, dep.taskname, err))
                     if changed:
@@ -1816,7 +1816,7 @@ class TaskDependencies:
                 if row['changed_by']:
                     try:
                         changed = row['changed_by']
-                    except TypeError, err:
+                    except TypeError as err:
                         changed = None
                         logger.warning("Encoding problem for changelog author in Vcs of package '%s' in task %s (%s)" % (dep.pkg, dep.taskname, err))
                     if changed:
@@ -1896,7 +1896,7 @@ class TaskDependencies:
                 if self.properties.get('vcs-browser', HOMEPAGENONE) == HOMEPAGENONE:
                     try:
                         self.properties['vcs-browser'] = BrowserFromVcsURL(self.properties['vcs-type'], self.properties['vcs-url'])
-                    except KeyError, err:
+                    except KeyError as err:
                         logger.warning("Vcs Property missing in Database:", self.properties, err)
                 if not self.properties.get('vcs-type'):
                     if self.properties.get('vcs-browser', HOMEPAGENONE) != HOMEPAGENONE:
diff --git a/webtools/bugs.py b/webtools/bugs.py
index 7ee9167..6dcc0ad 100755
--- a/webtools/bugs.py
+++ b/webtools/bugs.py
@@ -35,10 +35,10 @@ debug = 0
 try:
     conn = psycopg2.connect(host="localhost", port=PORT,
                             user="guest", database="udd")
-except psycopg2.OperationalError, err:
+except psycopg2.OperationalError as err:
     try:
         conn = psycopg2.connect("service=udd")
-    except psycopg2.OperationalError, err:
+    except psycopg2.OperationalError ass err:
         # logger not known at this state: logger.warning
         stderr.write("Service=udd seems not to be installed on this host.\tMessage: %s" % (str(err)))
     try:
@@ -63,10 +63,10 @@ def _execute_udd_query(query):
         elapsed_time = time.time() - t
         if elapsed_time > SLOWQUERYREPORTLIMIT:  # report what query took longer than SLOWQUERYREPORTLIMIT seconds
             print("Time: %s\nQuery: %s" % (str(elapsed_time), query))
-    except psycopg2.ProgrammingError, err:
+    except psycopg2.ProgrammingError as err:
         stderr.write("Problem with query\n%s\n%s\n" % (query, str(err)))
         exit(-1)
-    except psycopg2.DataError, err:
+    except psycopg2.DataError as err:
         stderr.write("%s; query was\n%s\n" % (err, query))
 
 
diff --git a/webtools/new_upstream.py b/webtools/new_upstream.py
index 1b1a080..bb483ef 100755
--- a/webtools/new_upstream.py
+++ b/webtools/new_upstream.py
@@ -27,7 +27,7 @@ for task in packages.keys():
             printstring = printstring + "\n\t\tLast uploader was " + pkg_v_o[1]
         try:
             print(printstring)
-        except UnicodeEncodeError, err:
+        except UnicodeEncodeError as err:
             print("\t%s: (Problem printing UTF-8 data)\n\t\tHighest version in Debian is %s\n\t\tUpstream has %s\n" %
                   (pkg_v_o[0][0], pkg_v_o[0][1], pkg_v_o[0][2]))
             try:
diff --git a/webtools/thermometer.py b/webtools/thermometer.py
index d8c622b..0cae980 100755
--- a/webtools/thermometer.py
+++ b/webtools/thermometer.py
@@ -28,10 +28,10 @@ DEFAULTPORT = 5432
 # Define several prepared statements to query UDD
 try:
     conn = psycopg2.connect(host="localhost", port=PORT, user="guest", database="udd")
-except psycopg2.OperationalError, err:
+except psycopg2.OperationalError as err:
     try:
         conn = psycopg2.connect("service=udd")
-    except psycopg2.OperationalError, err:
+    except psycopg2.OperationalError as err:
         # logger not known at this state: logger.warning
         stderr.write("Service=udd seems not to be installed on this host.\tMessage: %s\n" % (str(err)))
         try:
@@ -52,10 +52,10 @@ curs = conn.cursor()
 def _execute_udd_query(query):
     try:
         curs.execute(query)
-    except psycopg2.ProgrammingError, err:
+    except psycopg2.ProgrammingError as err:
         stderr.write("Problem with query\n%s\n%s\n" % (query, str(err)))
         exit(-1)
-    except psycopg2.DataError, err:
+    except psycopg2.DataError as err:
         stderr.write("%s; query was\n%s\n" % (str(err), query))
 
 
@@ -415,14 +415,14 @@ the right shows the tasks of %s.""") \
     with codecs.open(outputfile, 'w', 'utf-8') as f:
         try:
             f.write(template.generate(**data).render('xhtml'))
-        except TypeError, err:
+        except TypeError as err:
             stderr.write("Problem creating thermometer.html.\tMessage: %s\n" % (str(err)))
     SetFilePermissions(outputfile)
     utemplate = loader.load('uthermometer.xhtml')
     with codecs.open(uoutputfile, 'w', 'utf-8') as f:
         try:
             f.write(utemplate.generate(**data).render('xhtml'))
-        except TypeError, err:
+        except TypeError as err:
             stderr.write("Problem creating uthermometer.html.\tMessage: %s\n" % (str(err)))
     SetFilePermissions(uoutputfile)
 

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list