[Blends-commit] [SCM] website branch, master, updated. 4c016db575165db9a75e26761169140835f9dff7
Ole Streicher
ole at aip.de
Fri Mar 18 15:59:41 UTC 2016
The following commit has been merged in the master branch:
commit f64ddd666e47ba2ba6ac75a7c44190ffa4db5756
Author: Ole Streicher <ole at aip.de>
Date: Fri Mar 18 14:56:23 2016 +0100
Move debtags to properties and use a dictionary for them
diff --git a/webtools/blendstasktools.py b/webtools/blendstasktools.py
index 9f35a1f..d720d6b 100644
--- a/webtools/blendstasktools.py
+++ b/webtools/blendstasktools.py
@@ -743,7 +743,6 @@ class DependantPackage:
self.outdated = {} # If not empty directory then release='upstream' and package is outdated
self.popcon = {} # dictionary containing vote and recnt values of popcon information
self.popconsubmit = 0 # number of popcon submissions - in case popcon import into UDD might be broken this remains 0
- self.debtags = [] # list of {'tag', 'value'} dictionary containing debtag information
self.screenshots = [] # list of {'version', 'url'} dictionary containing screenshot information
self.icon = None # URL of small screenshot icon
self.screenshot_url = None # URL to screenshots.debian.net
@@ -786,7 +785,6 @@ class DependantPackage:
ret += ", popcon = %i (%i)" % (self.popcon['vote'], self.popcon['recent'])
except:
pass
- ret += ", debtags = " + str(self.debtags)
if self.icon:
ret += ", screenshoticon = " + self.icon
if self.outdated:
@@ -1507,7 +1505,7 @@ class TaskDependencies:
self.dependencies[dep.pkgstatus].append(dep)
# Warn about remaining information of prospective package
- if dep.desc['en'] and dep.desc['en']['short'] and not dep.debtags:
+ if dep.desc['en'] and dep.desc['en']['short'] and 'debtags' not in dep.properties:
# prevent informing about packages which are just duplicated because of a broken query
logger.info("WNPP for package %s just closed - extra information can be removed from task file %s."
% (dep.pkg, dep.taskname))
@@ -1544,23 +1542,19 @@ class TaskDependencies:
if 'insts' in row:
dep.popcon['insts'] = row['insts']
- # Debtags as sorted list of dict fields
+ # Debtags
if row.get('debtags'):
- if dep.debtags: # there is no reasonable way that debtags was set before - so something is wrong here and a warning should be issued
- logger.warning("Debtags for package '%s' was just set. A duplicated result from database query is suspected. Please check the result!" % dep.pkg)
- tagdict = {}
- taglist = []
+ debtags = dep.properties.setdefault('debtags', {})
+ # there is no reasonable way that debtags was set before,
+ # so something is wrong here and a warning should be issued
+ if debtags:
+ logger.warning("Debtags for package '%s' was just set." % dep.pkg
+ + " A duplicated result from database query is suspected."
+ + " Please check the result!")
+
for debtag in row['debtags']:
(tag, value) = debtag.split('::')
- if tag in tagdict:
- tagdict[tag] += ', ' + value
- else:
- tagdict[tag] = value
- taglist.append(tag)
- if taglist:
- taglist.sort()
- for tag in taglist:
- dep.debtags.append({'tag': tag, 'value': tagdict[tag]})
+ debtags.setdefault(tag, []).append(value)
# screenshots
if row.get('icon'):
@@ -1723,7 +1717,6 @@ class TaskDependencies:
dep.pkgstatus = status
dep.component = row['component']
dep.version = [row['version']]
- dep.debtags = [] # prevent trying to print debtags (should be default setting but does not work in template (FIXME)
# Warn about remaining information of prospective package
if (dep.desc['en'] and dep.desc['en']['short']) or dep.properties['homepage'] != HOMEPAGENONE:
logger.info("The package %s is not yet in Debian but it is just in Blends %s Vcs. (Task %s)" % (dep.pkg, row['blend'], dep.taskname))
diff --git a/webtools/blendstasktools_udd.py b/webtools/blendstasktools_udd.py
index 9075b23..6281578 100644
--- a/webtools/blendstasktools_udd.py
+++ b/webtools/blendstasktools_udd.py
@@ -699,7 +699,7 @@ class DependantPackage:
self.outdated = {} # If not empty directory then release='upstream' and package is outdated
self.popcon = {} # dictionary containing vote and recnt values of popcon information
self.popconsubmit = 0 # number of popcon submissions - in case popcon import into UDD might be broken this remains 0
- self.debtags = [] # list of {'tag', 'value'} dictionary containing debtag information
+ self.debtags = {} # list of {'tag', 'value'} dictionary containing debtag information
self.screenshots = [] # list of {'version', 'url'} dictionary containing screenshot information
self.icon = None # URL of small screenshot icon
self.screenshot_url = None # URL to screenshots.debian.net
@@ -1148,23 +1148,18 @@ class TaskDependencies:
if 'insts' in row:
dep.popcon['insts'] = row['insts']
- # Debtags as sorted list of dict fields
if row.get('debtags'):
- if dep.debtags: # there is no reasonable way that debtags was set before - so something is wrong here and a warning should be issued
- logger.warning("Debtags for package '%s' was just set. A duplicated result from database query is suspected. Please check the result!" % dep.pkg)
- tagdict = {}
- taglist = []
+ debtags = dep.properties.setdefault('debtags', {})
+ # there is no reasonable way that debtags was set before,
+ # so something is wrong here and a warning should be issued
+ if debtags:
+ logger.warning("Debtags for package '%s' was just set." % dep.pkg
+ + " A duplicated result from database query is suspected."
+ + " Please check the result!")
+
for debtag in row['debtags']:
(tag, value) = debtag.split('::')
- if tag in tagdict:
- tagdict[tag] += ', ' + value
- else:
- tagdict[tag] = value
- taglist.append(tag)
- if taglist:
- taglist.sort()
- for tag in taglist:
- dep.debtags.append({'tag': tag, 'value': tagdict[tag]})
+ debtags.setdefault(tag, []).append(value)
# screenshots
if row.get('icon'):
diff --git a/webtools/templates/packages.xhtml b/webtools/templates/packages.xhtml
index d402886..b9968bc 100644
--- a/webtools/templates/packages.xhtml
+++ b/webtools/templates/packages.xhtml
@@ -461,16 +461,16 @@ function show_fulldesc(hash) {
</ul>
</dd>
</py:if>
- <py:if test="project.debtags">
+ <py:if test="'debtags' in project.properties">
<dt>Tags</dt>
<dd>
<a class="editlink" title="Edit tags" href="https://debtags.debian.org/edit/${project.pkg}">
✏
</a>
<dl class="debtags desc-inline">
- <py:for each="debtag in project.debtags">
- <dt>${debtag['tag']}</dt>
- <dd>${debtag['value']}</dd>
+ <py:for each="tag, values in sorted(project.properties['debtags'].items())">
+ <dt>${tag}</dt>
+ <dd>${', '.join(values)}</dd>
</py:for>
</dl>
</dd>
@@ -593,7 +593,7 @@ function show_fulldesc(hash) {
</py:if>
<py:if test="project.component == 'main'
and project.pkgstatus in ('official_high', 'official_low', 'experimental')
- and (not project.icon or not project.debtags
+ and (not project.icon or 'debtags' not in project.properties
or (lang != 'en' and lang not in project.desc))">
<dt>Improve entry</dt>
<dd>
@@ -603,7 +603,7 @@ function show_fulldesc(hash) {
Upload Screenshot
</a>
</li>
- <li py:if="not project.debtags">
+ <li py:if="'debtags' not in project.properties">
<a href="https://debtags.debian.org/edit/${project.pkg}">
Create tags
</a>
diff --git a/webtools/templates/tasks.xhtml b/webtools/templates/tasks.xhtml
index b0f7be1..640d098 100644
--- a/webtools/templates/tasks.xhtml
+++ b/webtools/templates/tasks.xhtml
@@ -108,11 +108,11 @@
</tr>
</table>
</span>
- <span py:if="project.debtags != []" class="tooltip" id="${project.pkg}-debtags">
+ <span py:if="'debtags' in project.properties" class="tooltip" id="${project.pkg}-debtags">
<table class="versionclass">
<tr><th colspan="2" class="versionclass"><strong>Debtags of package ${project.pkg}:</strong></th></tr>
- <py:for each="debtag in project.debtags">
- <tr><td class="release">${debtag['tag']}</td><td class="version">${debtag['value']}</td></tr>
+ <py:for each="tag, values in sorted(project.properties['debtags'].items())">
+ <tr><td class="release">${tag}</td><td class="version">${', '.join(values)}</td></tr>
</py:for>
</table>
</span>
@@ -126,7 +126,7 @@
</div>
</div>
<div py:choose="">
- <div py:when="project.debtags != []" class="project-info" onmouseover="TagToTip('${project.pkg}-debtags', FIX, ['${project.pkg}', 0, 0])" onmouseout="UnTip()"><a href="https://debtags.debian.org/edit/${project.pkg}">Edit Debtags</a></div>
+ <div py:when="'debtags' in project.properties" class="project-info" onmouseover="TagToTip('${project.pkg}-debtags', FIX, ['${project.pkg}', 0, 0])" onmouseout="UnTip()"><a href="https://debtags.debian.org/edit/${project.pkg}">Edit Debtags</a></div>
<div py:otherwise="">
<div class="project-infomissing"><a href="https://debtags.debian.org/edit/${project.pkg}">Go tagging</a></div>
</div>
--
Static and dynamic websites for Debian Pure Blends
More information about the Blends-commit
mailing list