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

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


The following commit has been merged in the master branch:
commit 0dbbbb21ea567fe7fedd867acdd858050872ca1f
Author: Ole Streicher <ole at aip.de>
Date:   Fri Mar 18 16:35:35 2016 +0100

    Put all Screenshot properties into one dictionary

diff --git a/webtools/blendstasktools.py b/webtools/blendstasktools.py
index 636c6e2..eba590c 100644
--- a/webtools/blendstasktools.py
+++ b/webtools/blendstasktools.py
@@ -740,9 +740,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.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
         self.filename       = None  # Filename of package in the Debian pool
         self.desc           = {}    # Prospective packages should have a description ...
                                     # ... which could be copied to (or from if exists)
@@ -778,8 +775,6 @@ class DependantPackage:
             ret += ", desc: "         + str(self.desc)
         for prop in self.properties:
             ret += ", %s: %s" % (prop, str(self.properties[prop]))
-        if self.icon:
-            ret += ", screenshoticon = " + self.icon
         if self.outdated:
             ret += ", dehsstatus = " + str(self.outdated)
 
@@ -1541,14 +1536,16 @@ class TaskDependencies:
 
                 # screenshots
                 if row.get('icon'):
-                    dep.icon           = row['icon'][0]
-                    dep.image          = row['image'][0]
-                    dep.screenshot_url = 'http://screenshots.debian.net/package/' + dep.pkg
-                    for i in range(1, len(row['image'])):
-                        dep.screenshots.append({
-                            'version': row['screenshot_versions'][i],
-                            'url': row['image'][i]
-                        })
+                    img = dep.properties.setdefault('screenshot', {})
+                    img['icon'] = row['icon'][0]
+                    img['image'] = row['image'][0]
+                    if len(row['image']) > 1:
+                        screenshots = img.setdefault('screenshots', [])
+                        for i in range(1, len(row['image'])):
+                            screenshots.append({
+                                'version': row['screenshot_versions'][i],
+                                'url': row['image'][i]
+                            })
 
                 # it might be that the new upstream goes to experimental - this should be ignored here
                 if row.get('unstable_parsed_version'):
diff --git a/webtools/blendstasktools_udd.py b/webtools/blendstasktools_udd.py
index 041f734..fe0f738 100644
--- a/webtools/blendstasktools_udd.py
+++ b/webtools/blendstasktools_udd.py
@@ -1156,14 +1156,16 @@ class TaskDependencies:
 
             # screenshots
             if row.get('icon'):
-                dep.icon           = row['icon'][0]
-                dep.image          = row['image'][0]
-                dep.screenshot_url = 'http://screenshots.debian.net/package/' + dep.pkg
-                for i in range(1, len(row['image'])):
-                    dep.screenshots.append({
-                        'version': row['screenshot_versions'][i],
-                        'url': row['image'][i]
-                    })
+                img = dep.properties.setdefault('screenshot', {})
+                img['icon'] = row['icon'][0]
+                img['image'] = row['image'][0]
+                if len(row['image']) > 1:
+                    screenshots = img.setdefault('screenshots', [])
+                    for i in range(1, len(row['image'])):
+                        screenshots.append({
+                            'version': row['screenshot_versions'][i],
+                            'url': row['image'][i]
+                        })
 
             # it might be that the new upstream goes to experimental - this should be ignored here
             if row.get('unstable_parsed_version'):
diff --git a/webtools/templates/packages.xhtml b/webtools/templates/packages.xhtml
index 5ae2ec7..0964aea 100644
--- a/webtools/templates/packages.xhtml
+++ b/webtools/templates/packages.xhtml
@@ -336,17 +336,17 @@ function show_fulldesc(hash) {
 		  </h3>
 		  <dl class="pkgdesc">
 		    <py:choose>
-		      <py:when test="project.icon">
+		      <py:when test="'screenshot' in project.properties">
 			<dt class="screenshot">
 			  <a class="tooltip" href="http://screenshots.debian.net/package/${project.pkg}">
-			    <img src="${project.icon}" alt="Description:" />
+			    <img src="${project.properties['screenshot']['icon']}" alt="Description:" />
 			    <span class="tooltip centered">
-			      <img src="${project.image}" />
-			      <table py:if="project.screenshots != []" class="versionclass">
+			      <img src="${project.properties['screenshot']['image']}" />
+			      <table py:if="'screenshots' in project.properties['screenshot']" class="versionclass">
 				<tr><th colspan="3"
 					class="versionclass"><strong>Other screenshots of package ${project.pkg}</strong></th></tr>
 				<tr><th class="version">Version</th><th class="archs">URL</th></tr>
-				<py:for each="screenshot in project.screenshots">
+				<py:for each="screenshot in project.properties['screenshot']['screenshots']">
 				  <tr><td class="version">${screenshot['version']}</td><td class="archs"><a href="${screenshot['url']}">${screenshot['url']}</a></td></tr>
 				</py:for>
 			      </table>
@@ -593,12 +593,12 @@ 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 'debtags' not in project.properties
+				 and (not 'screenshot' in project.properties or 'debtags' not in project.properties
 				      or (lang != 'en' and lang not in project.desc))">
 		      <dt>Improve entry</dt>
 		      <dd>
 			<ul class="desc-inline">
-			  <li py:if="not project.icon">
+			  <li py:if="'screenshot' not in  project.properties">
 			    <a href="http://screenshots.debian.net/uploadfile?packagename=${project.pkg}">
 			      Upload Screenshot
 			    </a>
diff --git a/webtools/templates/tasks.xhtml b/webtools/templates/tasks.xhtml
index c7a0415..e5ae36e 100644
--- a/webtools/templates/tasks.xhtml
+++ b/webtools/templates/tasks.xhtml
@@ -199,19 +199,19 @@
 	   </td>
 	   <td py:if="project.component and project.pkgstatus != 'new' and project.pkgstatus != 'pkgvcs'" class="project-icon">
 	     <div py:choose="">
-	       <div py:when="project.icon != None">
+	       <div py:when="'screenshot' in project.properties">
 		 <span class="tooltip" id="${project.pkg}-screenshot">
-		   <img src="${project.image}" />
-		   <table py:if="project.screenshots != []" class="versionclass">
+		   <img src="${project.properties['screenshot']['image']}" />
+		   <table py:if="'screenshots' in project.properties['screenshot']" class="versionclass">
 		     <tr><th colspan="3"
 		     class="versionclass"><strong>Other screenshots of package ${project.pkg}</strong></th></tr>
 		     <tr><th class="version">Version</th><th class="archs">URL</th></tr>
-		     <py:for each="screenshot in project.screenshots">
+		     <py:for each="screenshot in project.properties['screenshot']['screenshots']">
 		       <tr><td class="version">${screenshot['version']}</td><td class="archs"><a href="${screenshot['url']}">${screenshot['url']}</a></td></tr>
 		     </py:for>
 		   </table>
 		 </span>
-                 <a href="http://screenshots.debian.net/package/${project.pkg}"><img class="icon" src="${project.icon}" width="300" alt="Screenshots of package ${project.pkg}" onmouseover="TagToTip('${project.pkg}-screenshot', FIX, ['${project.pkg}', 80, -100])" onmouseout="UnTip()" /></a>
+                 <a href="http://screenshots.debian.net/package/${project.pkg}"><img class="icon" src="${project.properties['screenshot']['icon']}" width="300" alt="Screenshots of package ${project.pkg}" onmouseover="TagToTip('${project.pkg}-screenshot', FIX, ['${project.pkg}', 80, -100])" onmouseout="UnTip()" /></a>
                </div>
 	       <div py:otherwise="" class="project-infomissing"><a href="http://screenshots.debian.net/uploadfile?packagename=${project.pkg}">Upload screenshot</a></div>
              </div>

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list