[Cdd-commits] r1281 - in blends/trunk/webtools: . templates

CDD Subversion Commit noreply at alioth.debian.org
Fri Dec 12 10:53:00 UTC 2008


Author: tille
Date: Fri Dec 12 10:52:59 2008
New Revision: 1281

Modified:
   blends/trunk/webtools/deploy-svn
   blends/trunk/webtools/tasks.py
   blends/trunk/webtools/templates/packagelist.xhtml
   blends/trunk/webtools/templates/tasks.xhtml
Log:
Render list of packages per Blend


Modified: blends/trunk/webtools/deploy-svn
==============================================================================
--- blends/trunk/webtools/deploy-svn	(original)
+++ blends/trunk/webtools/deploy-svn	Fri Dec 12 10:52:59 2008
@@ -18,7 +18,7 @@
 cd $BASE/webtools
 ./mkmo.sh
 
-# SOmehow blend-get-names is not executable ... workaround
+# Somehow blend-get-names is not executable ... workaround
 chmod 775 blend-get-names
 
 # ensure the Group has write permissions...

Modified: blends/trunk/webtools/tasks.py
==============================================================================
--- blends/trunk/webtools/tasks.py	(original)
+++ blends/trunk/webtools/tasks.py	Fri Dec 12 10:52:59 2008
@@ -107,6 +107,7 @@
 	data['nohomepage']         = _('Homepage not available')
 	data['translatedesc']      = _('Translate description')
 	data['fixtranslation']     = _('Fix translated description')
+	data['tableofcontents']    = _('Table of contents')
 	if data['advertising'] != None:
 		# If data['advertising'] is enclosed in _() gettext tries to ask for translations of 'advertising'
 		# which makes no sense.  That's why this is masked by an extra string variable
@@ -172,11 +173,14 @@
 		
 	f.close()
 
+	data['dependencies'] = {}
+	data['projects']     = {}
 	for task in data['taskskeys']:
-		data['task']         = task
-		data['projectkeys']  = cdeps.GetListOfDepsForTask(task, dependencytypes=())
-		data['dependencies'] = []
-		data['colorcodes']   = []
+		data['task']               = task
+		data['projectkeys']        = cdeps.GetListOfDepsForTask(task, dependencytypes=())
+		# Keep the Dependency lists per task to be able to loop over all tasks in plain package list
+		data['dependencies'][task] = []
+		data['colorcodes']         = []
 		# data['typelinks']    = [] # set links from legend to headlines of different types
 		official             = 0 # set to 1 if at least one official category was found
 		for type in ['depends', 'recommends', 'suggests', 'unofficial', 'prospective', 'unknown']:
@@ -188,7 +192,7 @@
 				for dep in cdeps.tasks[task].dependencies[type]:
 				    print >>stderr, "Warning: Dependency with unknown status:", dep.pkg
 			else:
-			    data['dependencies'].append(type)
+			    data['dependencies'][task].append(type)
 			    if data['typeclass'][type] == 'official':
 				    if official == 0:
 					    data['colorcodes'].append(Markup(COLORCODES['official']))
@@ -196,9 +200,10 @@
 			    else:
 				    data['colorcodes'].append(Markup(COLORCODES[type]))
 
-		data['projects']     = cdeps.tasks[task].dependencies
-		data['othertasks']   = _("Links to other tasks")
-		data['indexlink']    = _("Index of all tasks")
+		# Keep the Project lists per task to be able to loop over all tasks in plain package list
+		data['projects'][task] = cdeps.tasks[task].dependencies
+		data['othertasks']     = _("Links to other tasks")
+		data['indexlink']      = _("Index of all tasks")
 
 		outputfile = outputdir + '/' + task + '.html'
 	        if lang != 'xyz': # let 'en' be a language as any other and add suffix to file name
@@ -219,4 +224,30 @@
 
 		f.close()
 
+	template = loader.load('packagelist.xhtml')
+
+	outputfile = outputdir + '/packagelist.html'
+	if lang != 'xyz': # let 'en' be a language as any other and add suffix to file name
+		outputfile += '.' + lang
+	try:
+		os.unlink(outputfile)
+	except: # simply continue if file does not exist
+		pass
+	f = open(outputfile, 'w')
+
+	data['projectsintasks'] = []
+	for task in data['taskskeys']:
+		data['projectsintasks']     = cdeps.tasks[task].dependencies
+
+	try:
+		print >> f, template.generate(**data).render('xhtml')
+	except UnicodeDecodeError, errtxt:
+		print >> stderr, \
+		    "Some critical encoding problem occured when trying to render index for lang %s.\n%s" \
+		    % (lang, errtxt)
+		
+	f.close()
+
+
+
 htafp.close()

Modified: blends/trunk/webtools/templates/packagelist.xhtml
==============================================================================
--- blends/trunk/webtools/templates/packagelist.xhtml	(original)
+++ blends/trunk/webtools/templates/packagelist.xhtml	Fri Dec 12 10:52:59 2008
@@ -50,20 +50,23 @@
 	  <span py:when="tasks[task].metapkg.desc.has_key(lang)">${tasks[task].metapkg.desc[lang]['long']}</span>
 	  <span py:otherwise="">${tasks[task].metapkg.desc['en']['long']}</span>
 	</p>
-	<dl>
-	  <py:for each="project in projects[task]">
-	    <dt><span py:choose="project.homepage">
-                  <span py:when="'#'">${project.pkg.capitalize()}</span>
-                  <span py:otherwise=""><a href="$project.homepage">${project.pkg.capitalize()}</a></span>
-	        </span>
-	    </dt>
-	    <dd><span py:choose="">
-	           <span py:when="project.desc.has_key(lang)">${project.desc[lang]['short']}</span>
-	           <span py:otherwise="">${project.desc['en']['short']}</span>
-	         </span>
-	    </dd>
-	  </py:for>
-	</dl>
+	<py:for each="type in dependencies[task]">
+	  <h3>${typeheading[type]}</h3>
+	  <dl>
+	  <py:for each="project in projects[task][type]">
+		  <dt><span py:choose="project.homepage">
+		    <span py:when="'#'">${project.pkg.capitalize()}</span>
+		    <span py:otherwise=""><a href="$project.homepage">${project.pkg.capitalize()}</a></span>
+		  </span>
+		  </dt>
+		  <dd><span py:choose="">
+		    <span py:when="project.desc.has_key(lang)">${project.desc[lang]['short']}</span>
+		    <span py:otherwise="">${project.desc['en']['short']}</span>
+		  </span>
+		  </dd>
+	    </py:for>
+	  </dl>
+	</py:for>
       </py:for>
     </div>
   </td>

Modified: blends/trunk/webtools/templates/tasks.xhtml
==============================================================================
--- blends/trunk/webtools/templates/tasks.xhtml	(original)
+++ blends/trunk/webtools/templates/tasks.xhtml	Fri Dec 12 10:52:59 2008
@@ -70,9 +70,9 @@
 	<td class="main">
 		<div class="pageBody">
 			<h1>$projectname ${tasks[task].metapkg.PrintedName.capitalize()} packages</h1>
-<py:for each="type in dependencies">
+<py:for each="type in dependencies[task]">
 			<h2><a id="${type}-debs" name="${type}-debs"/>${typeheading[type]}</h2>
-   <py:for each="project in projects[type]">
+   <py:for each="project in projects[task][type]">
      <table class="project" summary="${project.pkg}">
        <tbody>
 	 <tr class="deb-${typeclass[type]}">



More information about the Cdd-commits mailing list