[Blends-commit] [SCM] website branch, master, updated. 06fdc55b523070dce259e189817e0ca3abe85ff5

Ole Streicher olebole at debian.org
Sat Mar 5 19:45:24 UTC 2016


The following commit has been merged in the master branch:
commit 06fdc55b523070dce259e189817e0ca3abe85ff5
Author: Ole Streicher <olebole at debian.org>
Date:   Sat Mar 5 20:45:13 2016 +0100

    Remove UnicodeError handling: should be gone now

diff --git a/webtools/blendstasktools.py b/webtools/blendstasktools.py
index 684eea8..84a7aa1 100644
--- a/webtools/blendstasktools.py
+++ b/webtools/blendstasktools.py
@@ -20,6 +20,7 @@ DEFAULTPORT=5432
 
 from sys import stderr, exit
 from subprocess import Popen, PIPE
+import codecs
 import os
 import grp
 import stat
@@ -198,7 +199,7 @@ for pkgstat in pkgstatus:
         if dep not in dep_strength_keys:
             dep_strength_keys.append(dep)
 
-rmpub = open('remove-publications-from-tasks-files.dat','w+')
+rmpub = codecs.open('remove-publications-from-tasks-files.dat','w+', 'utf-8')
 
 license_in_component = {'main'     : 'DFSG free',
                         'contrib'  : 'DFSG free, but needs non-free components',
@@ -782,10 +783,7 @@ class DependantPackage:
         if self.desc:
             ret += ", desc: "         + str(self.desc)
         for prop in self.properties.keys():
-            try:
-                ret += ", %s: %s" % (prop, str(self.properties[prop]))
-            except UnicodeEncodeError:            
-                ret += ", %s: <UnicodeEncodeError>" % (prop)
+            ret += ", %s: %s" % (prop, str(self.properties[prop]))
         try:
             ret += ", popcon = %i (%i)" % (self.popcon['vote'], self.popcon['recent'])
         except:
@@ -847,10 +845,7 @@ class DependantPackage:
                     self.properties['published'] = {}
                 if self.properties['published'].has_key(pub):
                     if self.properties['published'][pub] == row[pub]:
-                    	try:
-                           print >>rmpub, "%s: %s: Published-%s: %s" % (self.taskname, self.pkg, pub, row[pub])
-            	        except UnicodeEncodeError:
-            	           print >>rmpub, "--- %s: %s: Published-%s: some duplicated value featuring encoding problems ---" % (self.taskname, self.pkg, pub)
+                        rmpub.write("%s: %s: Published-%s: %s" % (self.taskname, self.pkg, pub, row[pub]))
             		logger.info("%s/%s: Publication-%s = %s can be removed"  % (self.taskname, self.pkg, pub, row[pub]))
             	    else:
             	        logger.info("%s conflicting fields Publication-%s in tasks file with value '%s' and in UDD with value '%s'" % (self.pkg, pub, self.properties['published'][pub], row[pub]))
@@ -1184,21 +1179,10 @@ class TaskDependencies:
         for lang in languages:
             if ddtptranslations['description_'+lang]:
                 self.metapkg.desc[lang] = {}
-                try:
-                    short = ddtptranslations['description_'+lang]
-                    self.metapkg.desc[lang]['short'] = MarkupString(short, self.metapkg.pkg, 'taskShortDesc', lang)
-                except UnicodeEncodeError, err:
-                    logger.error("===> UnicodeDecodeError in metapackage %s (lang='%s'): '%s'; ErrTxt: %s" % \
-                                     (self.metapkg.pkg, lang, ddtptranslations['description_'+lang], err))
-                    short = to_unicode(ddtptranslations['description_'+lang],'latin1')
-                    self.metapkg.desc[lang]['short'] = MarkupString(short, self.metapkg.pkg, 'taskShortDesc' + lang)
-    
+                short = ddtptranslations['description_'+lang]
+                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 UnicodeDecodeError, err:
-                    logger.error("===> UnicodeDecodeError in metapackage long %s (lang='%s'): '%s'; ErrTxt: %s" % \
-                                     (self.metapkg.pkg, lang, ddtptranslations['long_description_'+lang], err))
-                    self.metapkg.desc[lang]['long'] = 'UnicodeDecodeError'
                 except AttributeError, err:
                     logger.error("===> AttributeError in metapackage long %s (lang='%s'): '%s'; ErrTxt: %s" % \
                                      (self.metapkg.pkg, lang, ddtptranslations['long_description_'+lang], err))
@@ -1651,14 +1635,11 @@ class TaskDependencies:
                         changed = None
                         logger.warning("Encoding problem for last uploader of package '%s' in task %s (%s)" % (dep.pkg, dep.taskname, err))
                     if changed:
-                        try:
-                            (_name, _url) = email.Utils.parseaddr(changed)
-                            changed = '<a href="mailto:%s">%s</a>' % (_url, _name)
-                            dep.properties['changed_by']    = MarkupString(changed, dep.pkg, 'changed_by')
-                            dep.properties['last_uploader'] = changed
-                            dep.properties['last_uploader_simple'] = '%s <%s>' % (_name, _url)
-                        except UnicodeDecodeError, err:
-                            logger.error("Encoding problem for last uploader - assume same as maintainer for package %s (%s)", dep.pkg, err)
+                        (_name, _url) = email.Utils.parseaddr(changed)
+                        changed = '<a href="mailto:%s">%s</a>' % (_url, _name)
+                        dep.properties['changed_by']    = MarkupString(changed, dep.pkg, 'changed_by')
+                        dep.properties['last_uploader'] = changed
+                        dep.properties['last_uploader_simple'] = '%s <%s>' % (_name, _url)
 
                 # link to packages.debian.org search page to see overview about all
                 # package versions in all releases
@@ -1735,14 +1716,11 @@ class TaskDependencies:
                         changed = None
                         logger.warning("Encoding problem for uploader to ftpnew of package '%s' in task %s (%s)" % (dep.pkg, dep.taskname, err))
                     if changed:
-                        try:
-                            (_name, _url) = email.Utils.parseaddr(changed)
-                            changed = '<a href="mailto:%s">%s</a>' % (_url, _name)
-                            dep.properties['changed_by']    = MarkupString(changed, dep.pkg, 'changed_by')
-                            dep.properties['last_uploader'] = changed
-                            dep.properties['last_uploader_simple'] = '%s <%s>' % (_name, _url)
-                        except UnicodeDecodeError, err:
-                            logger.error("Encoding problem for last uploader - assume same as maintainer for package %s (%s)", dep.pkg, err)
+                        (_name, _url) = email.Utils.parseaddr(changed)
+                        changed = '<a href="mailto:%s">%s</a>' % (_url, _name)
+                        dep.properties['changed_by']    = MarkupString(changed, dep.pkg, 'changed_by')
+                        dep.properties['last_uploader'] = changed
+                        dep.properties['last_uploader_simple'] = '%s <%s>' % (_name, _url)
 
         # Verify whether there are virtual packages which are provided by some other packages in the list of dependencies
         query = "EXECUTE query_provides('%s')" % List2PgArray(pkgs_in_pool)
@@ -1820,14 +1798,11 @@ class TaskDependencies:
                         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:
-                        try:
-                            (_name, _url) = email.Utils.parseaddr(changed)
-                            changed = '<a href="mailto:%s">%s</a>' % (_url, _name)
-                            dep.properties['changed_by']    = MarkupString(changed, dep.pkg, 'changed_by')
-                            dep.properties['last_uploader'] = changed
-                            dep.properties['last_uploader_simple'] = '%s <%s>' % (_name, _url)
-                        except UnicodeDecodeError, err:
-                            logger.error("Encoding problem for changer - assume same as maintainer for package %s (%s)", dep.pkg, err)
+                        (_name, _url) = email.Utils.parseaddr(changed)
+                        changed = '<a href="mailto:%s">%s</a>' % (_url, _name)
+                        dep.properties['changed_by']    = MarkupString(changed, dep.pkg, 'changed_by')
+                        dep.properties['last_uploader'] = changed
+                        dep.properties['last_uploader_simple'] = '%s <%s>' % (_name, _url)
 
         # Verify whether packages which are neither in pool, new, vcs nor virtual have sufficient information in task file
         for status in self.dependencies.keys():

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list