[Blends-commit] [SCM] website branch, master, updated. 4c016db575165db9a75e26761169140835f9dff7

Ole Streicher ole at aip.de
Fri Mar 18 15:59:47 UTC 2016


The following commit has been merged in the master branch:
commit 50e41e689381f113a069a736dbc01adbf677f028
Author: Ole Streicher <ole at aip.de>
Date:   Fri Mar 18 15:14:39 2016 +0100

    Move popcon to properties

diff --git a/webtools/blendstasktools.py b/webtools/blendstasktools.py
index d720d6b..24b797a 100644
--- a/webtools/blendstasktools.py
+++ b/webtools/blendstasktools.py
@@ -741,8 +741,6 @@ class DependantPackage:
         self.vcs_found      = 0     # we need a flag to store the fact whether Vcs information of a package is in UDD
         self.version        = []    # list of {'release', 'version', 'archs'} dictionary containing version and architecture information
         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.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
@@ -781,10 +779,6 @@ class DependantPackage:
             ret += ", desc: "         + str(self.desc)
         for prop in self.properties:
             ret += ", %s: %s" % (prop, str(self.properties[prop]))
-        try:
-            ret += ", popcon = %i (%i)" % (self.popcon['vote'], self.popcon['recent'])
-        except:
-            pass
         if self.icon:
             ret += ", screenshoticon = " + self.icon
         if self.outdated:
@@ -953,6 +947,8 @@ class Tasks:
             _execute_udd_query(query)
             if curs.rowcount > 0:
                 self.popconsubmit = curs.fetchone()[0]
+            else:
+                self.popconsubmit = None
             # Obtain packages that might enhance any of the packages in tasks list
             self.LinkEnhances()
 
@@ -1536,11 +1532,11 @@ class TaskDependencies:
                         })
 
                 if 'vote' in row:
-                    dep.popcon['vote']   = row['vote']
+                    dep.properties.setdefault('popcon', {})['vote'] = row['vote']
                 if 'recent' in row:   
-                    dep.popcon['recent'] = row['recent']
+                    dep.properties.setdefault('popcon', {})['recent'] = row['recent']
                 if 'insts' in row:
-                    dep.popcon['insts'] = row['insts']
+                    dep.properties.setdefault('popcon', {})['insts'] = row['insts']
 
                 # Debtags
                 if row.get('debtags'):
diff --git a/webtools/blendstasktools_udd.py b/webtools/blendstasktools_udd.py
index 6281578..7b70c47 100644
--- a/webtools/blendstasktools_udd.py
+++ b/webtools/blendstasktools_udd.py
@@ -697,8 +697,6 @@ class DependantPackage:
         self.vcs_found      = 0     # we need a flag to store the fact whether Vcs information of a package is in UDD
         self.version        = []    # list of {'release', 'version', 'archs'} dictionary containing version and architecture information
         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
@@ -738,10 +736,6 @@ class DependantPackage:
             ret += ", desc: "         + str(self.desc)
         for prop in self.properties:
             ret += ", %s: %s" % (prop, str(self.properties[prop]))
-        try:
-            ret += ", popcon = %i (%i)" % (self.popcon['vote'], self.popcon['recent'])
-        except:
-            pass
         ret += ", debtags = " + str(self.debtags)
         if self.icon:
             ret += ", screenshoticon = " + self.icon
@@ -900,6 +894,8 @@ class Tasks:
             _execute_udd_query(query)
             if curs.rowcount > 0:
                 self.popconsubmit = curs.fetchone()[0]
+            else:
+                self.popconsubmit = None
             # Obtain packages that might enhance any of the packages in tasks list
             self.LinkEnhances()
 
@@ -1142,11 +1138,11 @@ class TaskDependencies:
                     })
             
             if 'vote' in row:
-                dep.popcon['vote']   = row['vote']
+                dep.properties.setdefault('popcon', {})['vote'] = row['vote']
             if 'recent' in row:
-                dep.popcon['recent'] = row['recent']
+                dep.properties.setdefault('popcon', {})['recent'] = row['recent']
             if 'insts' in row:
-                dep.popcon['insts'] = row['insts']
+                dep.properties.setdefault('popcon', {})['insts'] = row['insts']
                            
             if row.get('debtags'):
                 debtags = dep.properties.setdefault('debtags', {})
diff --git a/webtools/tasks.py b/webtools/tasks.py
index 91c96be..a95579b 100755
--- a/webtools/tasks.py
+++ b/webtools/tasks.py
@@ -35,10 +35,7 @@ data['tasks']            = tasks.GetTaskDescDict()
 data['taskskeys']        = tasks.metapackagekeys
 data['PackageByName']    = tasks.PackageByName
 data['pkgcount']         = len(data['PackageByName'])
-try:
-    data['popconsubmit']     = tasks.popconsubmit
-except:
-    data['popconsubmit']     = 'unknown'
+data['popconsubmit'] = tasks.popconsubmit or 'unknown'
 data['languages']        = languages
 data['language_dict']    = language_dict
 
diff --git a/webtools/tasks_udd.py b/webtools/tasks_udd.py
index 4ee1254..58bf105 100755
--- a/webtools/tasks_udd.py
+++ b/webtools/tasks_udd.py
@@ -35,10 +35,7 @@ data['tasks']            = tasks.GetTaskDescDict()
 data['taskskeys']        = tasks.metapackagekeys
 data['PackageByName']    = tasks.PackageByName
 data['pkgcount']         = len(data['PackageByName'])
-try:
-    data['popconsubmit']     = tasks.popconsubmit
-except:
-    data['popconsubmit']     = 'unknown'
+data['popconsubmit'] = tasks.popconsubmit or 'unknown'
 data['languages']        = languages
 data['language_dict']    = language_dict
 
diff --git a/webtools/templates/packages.xhtml b/webtools/templates/packages.xhtml
index b9968bc..d67564b 100644
--- a/webtools/templates/packages.xhtml
+++ b/webtools/templates/packages.xhtml
@@ -475,20 +475,20 @@ function show_fulldesc(hash) {
 			</dl>
 		      </dd>
 		    </py:if>
-		    <py:if test="project.popcon and project.popcon['insts']">
+		    <py:if test="'popcon' in project.properties and project.properties['popcon']['insts']">
 		      <dt>Popularity</dt>
 		      <dd>
 			<ul class="desc-inline">
-			  <py:if test="project.popcon['vote']">
-			    <li>${project.popcon['vote']} regular users</li>
+			  <py:if test="project.properties['popcon']['vote']">
+			    <li>${project.properties['popcon']['vote']} regular users</li>
 			  </py:if>
-			  <py:if test="project.popcon['recent']">
+			  <py:if test="project.properties['popcon']['recent']">
 			    <li>
-			      ${project.popcon['recent']} recent
+			      ${project.properties['popcon']['recent']} recent
 			    </li>
 			  </py:if>
 			  <li>
-			    ${project.popcon['insts']} total installations
+			    ${project.properties['popcon']['insts']} total installations
 			    (of ${popconsubmit} submissions)
 			  </li>
 			</ul>
diff --git a/webtools/templates/tasks.xhtml b/webtools/templates/tasks.xhtml
index 640d098..8d557ea 100644
--- a/webtools/templates/tasks.xhtml
+++ b/webtools/templates/tasks.xhtml
@@ -116,9 +116,9 @@
 		 </py:for>
 	       </table>
 	     </span>
-	     <div py:if="project.popcon != {}"
+	     <div py:if="'popcon' in project.properties"
 	     class="popcon"><a href="http://qa.debian.org/popcon-png.php?packages=${project.pkg}%26show_vote=on%26show_recent=on%26want_legend=on">Popcon</a>:
-	     ${project.popcon['vote']} users (${project.popcon['recent']} upd.)<sup><a href="#popconexplanation">*</a></sup></div>
+	     ${project.properties['popcon']['vote']} users (${project.properties['popcon']['recent']} upd.)<sup><a href="#popconexplanation">*</a></sup></div>
 	     <div py:if="project.version != []">
 	       <div py:choose="">
 		 <div py:when="project.outdated == {}" class="project-info" onmouseover="TagToTip('${project.pkg}-versions', FIX, ['${project.pkg}', 0, 0])" onmouseout="UnTip()">Versions and Archs</div>

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list