[Blends-commit] [SCM] website branch, master, updated. 62b4b5d8b2d72459d39faf2a7c535e06ba4b8f6f
Ole Streicher
olebole at debian.org
Mon Jan 11 13:31:10 UTC 2016
The following commit has been merged in the master branch:
commit 22ce84b2dafa4fd1165dfc1daf3b2f36a0ec3d0f
Author: Ole Streicher <olebole at debian.org>
Date: Mon Jan 11 09:32:43 2016 +0100
Dont create temporary output file; do the %26->& replacement in-memory
diff --git a/webtools_py3/tasks_udd.py b/webtools_py3/tasks_udd.py
index 772347d..8b36e09 100755
--- a/webtools_py3/tasks_udd.py
+++ b/webtools_py3/tasks_udd.py
@@ -245,27 +245,20 @@ for lang in languages:
template = loader.load('packages.xhtml')
else:
template = loader.load('tasks.xhtml')
- with open(outputfile+'_tmp', "w") as f:
+ with open(outputfile, "w") as f:
try:
- f.write(template.generate(**data).render('xhtml'))
+# We had to mask ampersand ('&') from Genshi but even if the browser shows
+# the correct character packages.debian.org gets confused - so turn it back here
+ for line in template.generate(**data).render('xhtml').splitlines():
+ if detect_ampersand_code_re.search(line):
+ line = re.sub('%26', '&', line)
+ f.write(line + '\n')
except UnicodeDecodeError as errtxt:
print("Some critical encoding problem occured when trying to render task %s for lang %s.\n%s" \
% (task, lang, errtxt), file=stderr)
except UndefinedError as errtxt:
print("UndefinedError while rendering task %s for lang %s.\n%s" \
% (task, lang, errtxt), file=stderr)
- SetFilePermissions(outputfile+'_tmp')
- # Really rude hack to get back '<' / '>' signs which actually shoul be
- # in the output
- with open(outputfile+'_tmp', "r") as tmp:
- with open(outputfile, "w") as f:
- for line in tmp.readlines():
-# We had to mask ampersand ('&') from Genshi but even if the browser shows
-# the correct character packages.debian.org gets confused - so turn it back here
- if detect_ampersand_code_re.search(line):
- line = re.sub('%26', '&', line)
- f.write(line)
- os.unlink(outputfile+'_tmp')
SetFilePermissions(outputfile)
template = loader.load('packagelist.xhtml')
--
Static and dynamic websites for Debian Pure Blends
More information about the Blends-commit
mailing list