[Blends-commit] [SCM] website branch, master, updated. 7b71a0dfff6a1b22e142612332a9daca408581c1

Ole Streicher ole at aip.de
Tue Mar 15 13:09:06 UTC 2016


The following commit has been merged in the master branch:
commit 7b71a0dfff6a1b22e142612332a9daca408581c1
Author: Ole Streicher <ole at aip.de>
Date:   Tue Mar 15 14:08:59 2016 +0100

    Replace blendsmarkdown.MarkupString with genshi.Markup

diff --git a/webtools/blendsmarkdown.py b/webtools/blendsmarkdown.py
index 05622d1..46c6c7c 100644
--- a/webtools/blendsmarkdown.py
+++ b/webtools/blendsmarkdown.py
@@ -98,11 +98,4 @@ def SplitDescription(description):
 
     return (ShortDesc, LongDesc)
 
-
-def MarkupString(string, pkg, elem, lang='en'):
-    # Genshi does not touch strings that are marked with "Markup()"
-    # This function does the actual Markup call
-    # for any string with error checking
-    return Markup(string) if string is not None else None
-
 rendering_lib = ''
diff --git a/webtools/blendstasktools.py b/webtools/blendstasktools.py
index 0a098bf..763dba4 100644
--- a/webtools/blendstasktools.py
+++ b/webtools/blendstasktools.py
@@ -27,7 +27,7 @@ import psycopg2
 import gettext
 
 from genshi import Markup
-from blendsmarkdown import SplitDescription, MarkupString, render_longdesc
+from blendsmarkdown import SplitDescription, render_longdesc
 
 try:
     from debian import deb822
@@ -1126,7 +1126,7 @@ class TaskDependencies:
             if ddtptranslations['description_' + lang]:
                 self.metapkg.desc[lang] = {}
                 short = ddtptranslations['description_' + lang]
-                self.metapkg.desc[lang]['short'] = MarkupString(short, self.metapkg.pkg, 'taskShortDesc', lang)
+                self.metapkg.desc[lang]['short'] = Markup(short)
                 try:
                     self.metapkg.desc[lang]['long'] = Markup(render_longdesc(ddtptranslations['long_description_' + lang].splitlines()))
                 except AttributeError as err:
@@ -1183,8 +1183,8 @@ class TaskDependencies:
                     else:
                         (shortDesc, longDesc) = SplitDescription(stanza['description'])
                         # Markup strings to enable verbatim output of preformatted text
-                        self.metapkg.desc['en']['short'] = MarkupString(shortDesc, self.metapkg.PrintedName, 'taskShortDesc')
-                        self.metapkg.desc['en']['long']  = MarkupString(longDesc, self.metapkg.PrintedName, 'taskLongDesc')
+                        self.metapkg.desc['en']['short'] = Markup(shortDesc)
+                        self.metapkg.desc['en']['long']  = Markup(longDesc)
                         found_description = True
                     continue
                 if key == 'Meta-Depends':
@@ -1418,8 +1418,8 @@ class TaskDependencies:
                         _pkg = self.metapkg.PrintedName
                     else:
                         _pkg = dep.pkg
-                    remark['short'] = MarkupString(shortDesc, _pkg, 'RemarkShort')
-                    remark['long']  = MarkupString(longDesc, _pkg, 'RemarkLong')
+                    remark['short'] = Markup(shortDesc)
+                    remark['long']  = Markup(longDesc)
                     continue
                 else:
                     if key not in KEYSTOIGNORE:
@@ -1591,7 +1591,7 @@ class TaskDependencies:
                     if changed:
                         (_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['changed_by']    = Markup(changed)
                         dep.properties['last_uploader'] = changed
                         dep.properties['last_uploader_simple'] = '%s <%s>' % (_name, _url)
 
@@ -1602,8 +1602,7 @@ class TaskDependencies:
                 for l in languages:
                     if row.get('description_' + l):
                         dep.desc[l] = {}
-                        dep.desc[l]['short'] = MarkupString(row['description_' + l],
-                                                            dep.pkg, 'ShortDesc')
+                        dep.desc[l]['short'] = Markup(row['description_' + l])
                         if row['long_description_' + l]:
                             dep.desc[l]['long']  = Markup(render_longdesc(row['long_description_' + l].splitlines()))
                 if 'short' not in dep.desc['en']:
@@ -1663,7 +1662,7 @@ class TaskDependencies:
                     logger.info("The package %s is not yet in Debian but it is just in the new queue. (Task %s)" % (dep.pkg, dep.taskname))
                 for prop in PROPERTIES:
                     dep.properties[prop] = row[prop]
-                dep.desc['en']['short'] = MarkupString(row['description_en'], dep.pkg, 'ShortDesc - New')
+                dep.desc['en']['short'] = Markup(row['description_en'])
                 dep.desc['en']['long']  = Markup(render_longdesc(row['long_description_en'].splitlines()))
                 (_name, _url) = email.Utils.parseaddr(row['maintainer'])
                 dep.responsible = '<a href="mailto:%s">%s</a>' % (_url, _name)
@@ -1677,7 +1676,7 @@ class TaskDependencies:
                     if changed:
                         (_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['changed_by']    = Markup(changed)
                         dep.properties['last_uploader'] = changed
                         dep.properties['last_uploader_simple'] = '%s <%s>' % (_name, _url)
 
@@ -1747,7 +1746,7 @@ class TaskDependencies:
                 if int(row['wnpp']) > 0:
                     dep.properties['wnpp'] = row['wnpp']
                 dep.SetPublications(row)
-                dep.desc['en']['short'] = MarkupString(row['description_en'], dep.pkg, 'ShortDesc - New')
+                dep.desc['en']['short'] = Markup(row['description_en'])
                 dep.desc['en']['long']  = Markup(render_longdesc(row['long_description_en'].splitlines()))
                 (_name, _url) = email.Utils.parseaddr(row['maintainer'])
                 dep.responsible = '<a href="mailto:%s">%s</a>' % (_url, _name)
@@ -1760,7 +1759,7 @@ class TaskDependencies:
                     if changed:
                         (_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['changed_by']    = Markup(changed)
                         dep.properties['last_uploader'] = changed
                         dep.properties['last_uploader_simple'] = '%s <%s>' % (_name, _url)
 
@@ -1905,11 +1904,11 @@ class TaskDependencies:
 
         for dependency in self.dependencies.values():
             for dep in dependency:
-                dep.responsible = MarkupString(dep.responsible, dep.pkg, 'responsible')
+                dep.responsible = Markup(dep.responsible)
                 if dep.desc['en'] != {}:
-                    dep.desc['en']['short'] = MarkupString(dep.desc['en']['short'], dep.pkg, 'pkgShortDesc')
+                    dep.desc['en']['short'] = Markup(dep.desc['en']['short'])
                     try:
-                        dep.desc['en']['long'] = MarkupString(dep.desc['en']['long'], dep.pkg, 'pkgLongDesc')
+                        dep.desc['en']['long'] = Markup(dep.desc['en']['long'])
                     except KeyError:
                         logger.error("Dep has no English long description: %s", dep.pkg)
                         dep.desc['en']['long'] = "??? Missing long description for package %s" % dep.pkg
@@ -2022,7 +2021,7 @@ class PackageBugs:
         self.source     = pkgdict['source']
         self.homepage   = pkgdict['homepage']
         self.vcsbrowser = pkgdict['vcs-browser']
-        self.maintainer = MarkupString(pkgdict['maintainer'], self.pkgname, 'maintainer')
+        self.maintainer = Markup(pkgdict['maintainer'])
         self.bugs       = []      # open bugs
         self.nbugs      = 0
         self.severities = {}
diff --git a/webtools/blendstasktools_udd.py b/webtools/blendstasktools_udd.py
index 2ec2e92..c153b02 100644
--- a/webtools/blendstasktools_udd.py
+++ b/webtools/blendstasktools_udd.py
@@ -23,7 +23,7 @@ import email.utils
 import psycopg2
 
 from genshi import Markup
-from blendsmarkdown import SplitDescription, MarkupString, render_longdesc
+from blendsmarkdown import SplitDescription, render_longdesc
 
 try:
     from debian import deb822
@@ -1041,7 +1041,7 @@ class TaskDependencies:
             if ddtptranslations['description_' + lang]:
                 self.metapkg.desc[lang] = {}
                 short = ddtptranslations['description_' + lang]
-                self.metapkg.desc[lang]['short'] = MarkupString(short, self.metapkg.pkg, 'taskShortDesc', lang)
+                self.metapkg.desc[lang]['short'] = Markup(short)
                 try:
                     self.metapkg.desc[lang]['long'] = Markup(render_longdesc(ddtptranslations['long_description_' + lang].splitlines()))
                 except AttributeError as err:
@@ -1199,7 +1199,7 @@ class TaskDependencies:
                 if changed:
                     (_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['changed_by']    = Markup(changed)
                     dep.properties['last_uploader'] = (changed)                                  
                     dep.properties['last_uploader_simple'] = ('%s <%s>' % (_name, _url))
 
@@ -1210,8 +1210,7 @@ class TaskDependencies:
             for l in languages:
                 if row.get('description_' + l):
                     dep.desc[l] = {}
-                    dep.desc[l]['short'] = MarkupString((row['description_' + l]),
-                                                        dep.pkg, 'ShortDesc')
+                    dep.desc[l]['short'] = Markup(row['description_' + l])
                     if row['long_description_' + l]:
                         dep.desc[l]['long']  = Markup(render_longdesc(row['long_description_' + l].splitlines()))
             if 'short' not in dep.desc['en']:
@@ -1227,8 +1226,8 @@ class TaskDependencies:
 
             if row.get('remark'):
                 (short, long) = SplitDescription(row['remark'])
-                dep.remark['short'] = MarkupString(short, dep.pkg, 'RemarkShort')
-                dep.remark['long']  = MarkupString(long,  dep.pkg, 'RemarkLong')
+                dep.remark['short'] = Markup(short)
+                dep.remark['long']  = Markup(long)
 
             # Publications
             dep.SetPublications(row)
@@ -1249,8 +1248,8 @@ class TaskDependencies:
         if curs.rowcount > 0:
             self.metapkg.PrintedName, short, long = curs.fetchone()
             # Markup strings to enable verbatim output of preformatted text
-            self.metapkg.desc['en']['short'] = MarkupString(short, self.metapkg.PrintedName, 'taskShortDesc')
-            self.metapkg.desc['en']['long']  = MarkupString(long,  self.metapkg.PrintedName, 'taskLongDesc')
+            self.metapkg.desc['en']['short'] = Markup(short)
+            self.metapkg.desc['en']['long']  = Markup(long)
 
 
         # Get the package_name, license, dependency of the official dependencies of the task
@@ -1339,11 +1338,11 @@ class TaskDependencies:
 
         for dependency in self.dependencies.values():
             for dep in dependency:
-                dep.responsible = MarkupString(dep.responsible, dep.pkg, 'responsible')
+                dep.responsible = Markup(dep.responsible)
                 if dep.desc['en'] != {}:
-                    dep.desc['en']['short'] = MarkupString(dep.desc['en']['short'], dep.pkg, 'pkgShortDesc')
+                    dep.desc['en']['short'] = Markup(dep.desc['en']['short'])
                     try:
-                        dep.desc['en']['long'] = MarkupString(dep.desc['en']['long'], dep.pkg, 'pkgLongDesc')
+                        dep.desc['en']['long'] = Markup(dep.desc['en']['long'])
                     except KeyError:
                         logger.error("Dep has no English long description: %s", dep.pkg)
                         dep.desc['en']['long'] = "??? Missing long description for package %s" % dep.pkg
diff --git a/webtools/bugs.py b/webtools/bugs.py
index c4413e5..3219f9d 100755
--- a/webtools/bugs.py
+++ b/webtools/bugs.py
@@ -18,7 +18,6 @@ from genshi.template import TemplateLoader
 from genshi import Markup
 
 from blendstasktools import ReadConfig, RowDictionaries, CheckOrCreateOutputDir, SetFilePermissions
-from blendsmarkdown import MarkupString
 
 # PORT = 5441
 UDDPORT = 5452
@@ -237,7 +236,7 @@ def main():
             (_name, _url) = email.utils.parseaddr(pkg['maintainer'])
             sources['maintainer_email'] = _url
             sources['maintainer_name']  = _name
-            sources['maintainer']  = MarkupString('<a href="mailto:%s">%s</a>' % (_url, _name), pkg['source'], 'maintainer')
+            sources['maintainer']  = Markup('<a href="mailto:%s">%s</a>' % (_url, _name))
             if pkg['status'] == 'depends':
                 sources['bugs'] = bugs[pkg['source']]['open']
                 bugs_data[task][pkg['status'] + '_l'].append(pkg['source'])
@@ -265,7 +264,7 @@ def main():
                 (_name, _url) = email.utils.parseaddr(pkg['maintainer'])
                 sources['maintainer_email'] = _url
                 sources['maintainer_name']  = _name
-                sources['maintainer']  = MarkupString('<a href="mailto:%s">%s</a>' % (_url, _name), pkg['source'], 'maintainer')
+                sources['maintainer']  = Markup('<a href="mailto:%s">%s</a>' % (_url, _name))
                 sources['bugs']        = bugs[pkg['source']]['done']
                 bugs_data[task]['done_l'].append(pkg['source'])
                 bugs_data[task]['done']['sources'].append(sources)

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list