[med-svn] r1452 - trunk/community/infrastructure/scripts
tille at alioth.debian.org
tille at alioth.debian.org
Tue Feb 19 17:26:59 UTC 2008
Author: tille
Date: 2008-02-19 17:26:58 +0000 (Tue, 19 Feb 2008)
New Revision: 1452
Modified:
trunk/community/infrastructure/scripts/HTMLTemplate.py
trunk/community/infrastructure/scripts/cddtasktools.py
trunk/community/infrastructure/scripts/update-tasks
Log:
Prevent HTMLTemplate.py to Encode our strings - we just do this ourselves.
HTMLTemplate.py is buggy and ignores own {De,En}coders. I gave up to provide
a real fix but just changed the default encoder to do nothing.
Modified: trunk/community/infrastructure/scripts/HTMLTemplate.py
===================================================================
--- trunk/community/infrastructure/scripts/HTMLTemplate.py 2008-02-19 05:24:26 UTC (rev 1451)
+++ trunk/community/infrastructure/scripts/HTMLTemplate.py 2008-02-19 17:26:58 UTC (rev 1452)
@@ -3,6 +3,19 @@
See Manual.txt for documentation.
"""
+#### Shamelessly changed by Andreas Tille <tille at debian.org> to prevent
+#### Encoding.
+#### I tried to use
+#### HTMLTemplate.Template(renderIndex, f.read(), codecs=(myEncoder, myDecoder))
+#### and
+#### HTMLTemplate.Template(renderIndex, f.read(), codecs=(None,None))
+#### to prevent encoding but both failed. I even found out that this
+#### stuff is cheating in line
+#### /parser = Parser(attribute, codecs\[0\], codecs\[1\], warnings)/
+#### because if you call with None argument codecs[0] and codecs[1] just
+#### keep their default values (don't understand why)
+#### So I forced defaultEncoder to not encode input ...
+
# HTMLTemplate - A fast, powerful, easy-to-use HTML templating system.
#
# Copyright (C) 2004 HAS <hamish.sanderson at virgin.net>
@@ -48,8 +61,10 @@
def defaultEncoder(txt):
# Used to HTML-encode value in 'node.content = value'.
- return txt.replace('&', '&').replace(
- '<', '<').replace('>', '>').replace('"', '"')
+ return txt
+ ## Force to not Encode at all - Andreas Tille
+ ## txt.replace('&', '&').replace(
+ ## '<', '<').replace('>', '>').replace('"', '"')
def defaultDecoder(txt):
# Used to HTML-decode content in 'value = node.content'.
@@ -525,11 +540,19 @@
# Called by Node classes to add HTML element's content.
collector.append(self.raw)
+ # Enable user to provide None as Decoder - Andreas Tille <tille at debian.org>
def __contentGet(self):
- return self._decode(self.raw)
+ if self._decode == None:
+ return self.raw
+ else:
+ return self._decode(self.raw)
+ # Enable user to provide None as Encoder - Andreas Tille <tille at debian.org>
def __contentSet(self, txt):
- self.raw = self._encode(txt)
+ if self._encode == None:
+ raw = txt
+ else:
+ self.raw = self._encode(txt)
content = property(__contentGet, __contentSet,
doc="Get/Set this element's content as escaped text.")
Modified: trunk/community/infrastructure/scripts/cddtasktools.py
===================================================================
--- trunk/community/infrastructure/scripts/cddtasktools.py 2008-02-19 05:24:26 UTC (rev 1451)
+++ trunk/community/infrastructure/scripts/cddtasktools.py 2008-02-19 17:26:58 UTC (rev 1452)
@@ -13,7 +13,7 @@
# or if it is not contained it obtains information
# from tasks file about home page, license, WNPP etc.
-from sys import stderr
+from sys import stderr, exit
import os
import urllib
import StringIO
@@ -457,7 +457,8 @@
deppkg.homepage = '.' # Something else in case unexpected things happen
deppkg.version = stanza['version'].split('-')[0]
deppkg.section = stanza['section']
- deppkg.responsible = stanza['maintainer']
+ deppkg.responsible = re.sub('\s*(.+)\s+<(.+ at .+)>\s*', '<a href="mailto:\\2">\\1</a>', \
+ stanza['maintainer'])
deppkg.filename = BASEURL+stanza['filename']
self.packages[component][stanza['package']] = deppkg
f.close()
Modified: trunk/community/infrastructure/scripts/update-tasks
===================================================================
--- trunk/community/infrastructure/scripts/update-tasks 2008-02-19 05:24:26 UTC (rev 1451)
+++ trunk/community/infrastructure/scripts/update-tasks 2008-02-19 17:26:58 UTC (rev 1452)
@@ -26,6 +26,19 @@
# Template handlers
###
+# Do not Encode our strings - we do it ourself and want to take over responsiblity
+# for Links etc.
+def myEncoder(txt):
+ # Used to HTML-encode value in 'node.content = value'.
+ return txt
+
+# Do not Decode our strings - we do it ourself and want to take over responsiblity
+# for Links etc.
+def myDecoder(txt):
+ # Used to HTML-encode value in 'node.content = value'.
+ return txt
+
+
def renderIndex(node, tasks):
node.tasks.repeat(renderTaskList, tasks)
t = datetime.now()
@@ -197,7 +210,7 @@
base=HTMLBASE + '/' + CDD
# Let's render the Tasks Page index, first
f = open("%s/htdocs/tasks_idx.tmpl" % base)
-tmpl = HTMLTemplate.Template(renderIndex, f.read())
+tmpl = HTMLTemplate.Template(renderIndex, f.read(), codecs=(None,None)) ##myEncoder, myDecoder))
f.close()
f = open("%s/static/tasks/index.php" % base, "w")
More information about the debian-med-commit
mailing list