[Blends-commit] [SCM] website branch, master, updated. 2f4067e3c0364ef7ec4a3bae5848e1ac3d260951

Ole Streicher olebole at debian.org
Sun Jan 10 09:46:54 UTC 2016


The following commit has been merged in the master branch:
commit 2f4067e3c0364ef7ec4a3bae5848e1ac3d260951
Author: Ole Streicher <olebole at debian.org>
Date:   Sun Jan 10 10:42:18 2016 +0100

    Integrate Py2 changes inspired by debian-astro branch
     * new index tasks_idx.xhtml
     * new tasks.xhtml replacement packages.xhtml (used by debian-astro only so far)
     * Debian-Astro homepage debian-astro_idx.xhtml with teaser packages
    This all is still untested.

diff --git a/webtools_py3/blendstasktools_udd.py b/webtools_py3/blendstasktools_udd.py
index cadccd2..e942688 100644
--- a/webtools_py3/blendstasktools_udd.py
+++ b/webtools_py3/blendstasktools_udd.py
@@ -997,6 +997,17 @@ class Tasks:
                                         break
                             logger.debug(" %s -> %s" % (enh, dep.properties['Enhances'][enh]))
 
+    @property
+    def PackageByName(self):
+        try:
+            return self._packageByName
+        except AttributeError:
+            deps = []
+            for task in self.tasks.values():
+                for d in task.dependencies.values():
+                    deps += d
+            self._packageByName = dict((dep.pkg, dep) for dep in deps)
+            return self._packageByName
    
 class TaskDependencies:
     # List of depencencies defined in one metapackage
diff --git a/webtools_py3/tasks_udd.py b/webtools_py3/tasks_udd.py
index e376c7f..0f180a0 100755
--- a/webtools_py3/tasks_udd.py
+++ b/webtools_py3/tasks_udd.py
@@ -38,6 +38,7 @@ data = tasks.data
 # print("data : \n",data)
 data['tasks']            = tasks.GetTaskDescDict()
 data['taskskeys']        = tasks.metapackagekeys
+data['PackageByName']    = tasks.PackageByName
 try:
     data['popconsubmit']     = tasks.popconsubmit
 except: 
@@ -101,7 +102,14 @@ for lang in languages:
                               to you, or if you have prepared an unofficial Debian package, please do not hesitate to
                               send a description of that project to the <a href="mailto:%s">%s mailing list</a>""") % \
                                   (data['projectname'], data['projectlist'], data['projectname']))
-    data['description']       = ("The list to the right includes various software projects which are of some interest to the %s Project. Currently, only a few of them are available as Debian packages. It is our goal, however, to include all software in %s which can sensibly add to a high quality Debian Pure Blend.") % (data['projectname'], data['projectname'])
+    data['bugs']               = 'Bugs'
+    data['thermometer']        = 'Thermometer'
+    data['maintstats']         = 'Maintainer Stats'
+    data['contact']            = 'Contact'
+    data['contribute']         = 'Contribute'
+    data['description']        = 'Description'
+    data['metapackage']        = 'Metapackage'
+    data['packages']           = 'Packages'
     data['gtstrTasksPage']     = 'Tasks page'
     data['gtstrProject']	   = 'Project'
     data['gtstrThisIsAList']   = 'This is a list of the Tasks %s is made of:' % data['projectname']
@@ -130,7 +138,10 @@ for lang in languages:
 a set of packages that might help users to solve certain tasks of their work.  The list on
 the right shows the tasks of %s.""" ) \
                                       % ('<a href="http://blends.alioth.debian.org/blends/">', '</a>', data['projectname'])
-    data['idxsummary']        = Markup((data['idxsummary']))
+    data['idxsummary']        = '''The {0} Pure Blend contains {1} packages which
+    are grouped by metapackages. Each metapackage will cause the
+    installation of packages for a specific topic. The following table lists
+    the metapackages of {0}'''.format(data['projectname'], len(data['PackageByName']))
 
     pkgstatus['official_high']['headline']    = 'Official Debian packages with high relevance'
     # before fiddling around with unicode() read
@@ -186,6 +197,26 @@ the right shows the tasks of %s.""" ) \
 		
     f.close()
     SetFilePermissions(outputfile)
+    try:
+        template = loader.load('%s_idx.xhtml' % tasks.blendname)
+        outputfile = tasks.data['outputdir'] + '/index'
+        if lang != 'xyz': # let 'en' be a language as any other and add suffix to file name
+            outputfile += '.' + language_dict[lang]['short'] + '.html'
+        try:
+            os.unlink(outputfile)
+        except: # simply continue if file does not exist
+            pass
+        f = open(outputfile, 'w')
+        try:
+            print(template.generate(**data).render('xhtml'), file=f)
+        except UnicodeDecodeError as errtxt:
+            print("Some critical encoding problem occured when trying to render index for lang %s.\n%s"
+                  % (lang, errtxt), file = stderr)
+
+        f.close()
+        SetFilePermissions(outputfile)
+    except:
+        pass
 
     data['dependencies'] = {}
     data['projects']     = {}
@@ -234,7 +265,10 @@ the right shows the tasks of %s.""" ) \
         except: # simply continue if file does not exist
             pass
 
-        template = loader.load('tasks.xhtml')
+        if data['projectname'] == 'Debian Astro':
+            template = loader.load('packages.xhtml')
+        else:
+            template = loader.load('tasks.xhtml')
         f = open(outputfile+'_tmp', "w")
         try:
             print(template.generate(**data).render('xhtml'), file=f)
diff --git a/webtools/templates/debian-astro_idx.xhtml b/webtools_py3/templates/debian-astro_idx.xhtml
similarity index 100%
copy from webtools/templates/debian-astro_idx.xhtml
copy to webtools_py3/templates/debian-astro_idx.xhtml
diff --git a/webtools/templates/packages.xhtml b/webtools_py3/templates/packages.xhtml
similarity index 100%
copy from webtools/templates/packages.xhtml
copy to webtools_py3/templates/packages.xhtml
diff --git a/webtools_py3/templates/tasks_idx.xhtml b/webtools_py3/templates/tasks_idx.xhtml
index ce1dfdc..5f85b54 100644
--- a/webtools_py3/templates/tasks_idx.xhtml
+++ b/webtools_py3/templates/tasks_idx.xhtml
@@ -3,61 +3,107 @@
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="${lang}" lang="${lang}"
       xmlns:py="http://genshi.edgewall.org/">
-<head>
-<title>$projectname</title>
-<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8"/>
-<link href="/css/sentinel.css" type="text/css" rel="stylesheet"/>
-</head>
-<body>
-<div style="text-align: center;">
-<a href="$projecturl"><span py:choose="logourl">
-	           <span py:when="None">${projectname} Project</span>
-	           <span py:otherwise=""><img src="$logourl" alt="$projectname Project" height="93" /></span>
-                 </span>
-</a>
-</div>
-<div class="heading" py:if="projectadvertising">
-	<div class="tabBar" style="text-align: center;">$projectadvertising</div>
-</div>
-<table class="columns">
-<tr>
-	<td class="left">
-		<span class="section">$summary</span>
-		<div class="section">
-			<div class="sectionTop"></div>
-			<div class="row">${idxsummary}</div>
-		</div>
-	</td>
-	<td class="main">
-		<div class="pageBody">
-			<h1>$gtstrTasksPage</h1>
-			<p>$gtstrThisIsAList</p>
-			<dl>
-                             <py:for each="task in taskskeys">
-                                <dt><a href="${task}" name="${task}" id="${task}">${tasks[task].metapkg.PrintedName.capitalize()} - <span py:choose="">
-	           <span py:when="lang in tasks[task].metapkg.desc">${tasks[task].metapkg.desc[lang]['short']}</span>
-	           <span py:otherwise="">${tasks[task].metapkg.desc['en']['short']}</span>
-                 </span></a></dt>
-				<dd><span py:choose="">
-	           <span py:when="lang in tasks[task].metapkg.desc">${tasks[task].metapkg.desc[lang]['long']}</span>
-	           <span py:otherwise="">${tasks[task].metapkg.desc['en']['long']}</span>
-                 </span></dd>
-                             </py:for>
-			</dl>
-		</div>
-	</td>
-</tr>
-</table>
-<div id="footer">
-  <hr class="hidecss" />
-<p>${langavail}</p>
-<py:for each="l in languages">
-  <span py:if="lang != l" class="navpara">
-    <a href="index.${language_dict[l]['short']}.html" title="${language_dict[l]['title']}" hreflang="${language_dict[l]['htaccess']}" lang="${language_dict[l]['htaccess']}" rel="alternate">${language_dict[l]['printed']}</a>
-  </span>
-</py:for>
-<p>${howtosetlang}</p>
-  <address>${updatetimestamp}</address>
-</div>
-</body>
+  <head>
+    <title>$projectname</title>
+    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
+    <link href="http://www.debian.org/debhandheld.css" media="screen"
+	  rel="stylesheet" type="text/css" />
+    <link href="http://www.debian.org/debian.css" rel="stylesheet"
+	  type="text/css" />
+    <link href="http://blends.debian.org/css/blends.css" rel="stylesheet"
+	  type="text/css" />
+    <style type="text/css">
+/* <!-- */
+tr:nth-child(even) {
+    background-color: #eee;
+}
+table {
+    padding-bottom: 1.5em;
+}
+
+/* --> */
+    </style>
+    <link rel="shortcut icon" href="http://www.debian.org/favicon.ico" />
+  </head>
+  <body>
+    <div id="header">
+      <div id="upperheader">
+	<div id="logo">
+	  <a href="http://www.debian.org/" title="Debian Home">
+	    <img src= "http://www.debian.org/Pics/openlogo-50.png"
+		 alt="Debian" width="50" height= "61" /></a>
+	  </div>
+	  <p class="section">Pure Blend</p>
+	</div>
+	<div id="navbar">
+	  <span py:choose="">
+	    <span py:when="projectname == 'Debian Astro'">
+	      <ul>
+		<li><a href="$projecturl">$projectname</a></li>
+		<li><a href="../tasks">$packages</a></li>
+		<li><a href="../contact.html">$contact</a></li>
+		<li><a href="../contribute.html">$contribute</a></li>
+	      </ul>
+	    </span>
+	    <span py:otherwise="">
+	      <ul>
+		<li><a href="$projecturl">$projectname</a></li>
+		<li><a href="../tasks">$packages</a></li>
+		<li><a href="../bugs/">$bugs</a></li>
+		<li><a href="../thermometer/">$thermometer</a></li>
+		<li><a href="../maintstats/">$maintstats</a></li>
+	      </ul>
+	    </span>
+	  </span>
+	</div>
+      <p id="breadcrumbs">
+	<a href="http://blends.debian.org">Debian Pure Blends</a>
+	/ <a href="$projecturl">$projectname</a>
+	/ $packages
+      </p>
+    </div><!-- end header -->
+    <div id="content">
+      <h1>$projectname $packages</h1>
+      <p>
+	$idxsummary:
+      </p>
+      <table>
+	<thead>
+	  <tr><th>$metapackage</th><th>$description</th></tr>
+	</thead>
+	<tbody>
+          <py:for each="task in taskskeys">
+	    <tr>
+	      <td style="text-transform:capitalize;">
+		<a href="${task}" name="${task}" id="${task}">
+		  ${tasks[task].metapkg.PrintedName}
+		</a>
+	      </td>
+	      <td>
+		<span py:choose="">
+	          <span py:when="tasks[task].metapkg.desc.has_key(lang)">
+		    ${tasks[task].metapkg.desc[lang]['short']}
+		  </span>
+	          <span py:otherwise="">
+		    ${tasks[task].metapkg.desc['en']['short']}
+		  </span>
+		</span>
+	      </td>
+	    </tr>
+	  </py:for>
+	</tbody>
+      </table>
+    </div>
+    <div id="footer">
+      <hr class="hidecss" />
+      <p>${langavail}</p>
+      <py:for each="l in languages">
+	<span py:if="lang != l" class="navpara">
+	  <a href="index.${language_dict[l]['short']}.html" title="${language_dict[l]['title']}" hreflang="${language_dict[l]['htaccess']}" lang="${language_dict[l]['htaccess']}" rel="alternate">${language_dict[l]['printed']}</a>
+	</span>
+      </py:for>
+      <p>${howtosetlang}</p>
+      <address>${updatetimestamp}</address>
+    </div>
+  </body>
 </html>

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list