[Blends-commit] [SCM] website branch, master, updated. 62b4b5d8b2d72459d39faf2a7c535e06ba4b8f6f
Ole Streicher
olebole at debian.org
Mon Jan 11 13:31:11 UTC 2016
The following commit has been merged in the master branch:
commit 2c2deb801ed584d0ebeaa449854eeb11c324fbe5
Author: Ole Streicher <olebole at debian.org>
Date: Mon Jan 11 09:50:30 2016 +0100
Use os.path.join() instead of concatenating strings
diff --git a/webtools_py3/tasks_udd.py b/webtools_py3/tasks_udd.py
index 052a441..8362aad 100755
--- a/webtools_py3/tasks_udd.py
+++ b/webtools_py3/tasks_udd.py
@@ -74,7 +74,7 @@ if outputdir == None:
exit(-1)
t = datetime.now()
-htaccess = outputdir + '/.htaccess'
+htaccess = os.path.join(outputdir, 'htaccess')
htafp = open(htaccess, 'w')
htafp.write("DirectoryIndex index index.html\nOptions +MultiViews\n")
@@ -172,9 +172,7 @@ for lang in languages:
template = loader.load('tasks_idx.xhtml')
- outputfile = 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'
+ outputfile = os.path.join(outputdir, 'index.{0}.html'.format(lang))
with open(outputfile, 'w') as f:
try:
f.write(template.generate(**data).render('xhtml'))
@@ -184,9 +182,8 @@ for lang in languages:
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'
+ outputfile = os.path.join(tasks.data['outputdir'],
+ 'index.{0}.html'.format(lang))
with open(outputfile, 'w') as f:
try:
f.write(template.generate(**data).render('xhtml'))
@@ -237,9 +234,8 @@ for lang in languages:
data['othertasks'] = ("Links to other tasks")
data['indexlink'] = ("Index of all tasks")
- outputfile = outputdir + '/' + task
- if lang != 'xyz': # let 'en' be a language as any other and add suffix to file name
- outputfile += '.' + language_dict[lang]['short'] + '.html'
+ outputfile = os.path.join(outputdir,
+ '{0}.{1}.html'.format(task, lang))
if data['projectname'] == 'Debian Astro':
template = loader.load('packages.xhtml')
@@ -267,9 +263,8 @@ for lang in languages:
for task in data['taskskeys']:
data['projectsintasks'] = tasks.tasks[task].dependencies
- outputfile = outputdir + '/packagelist'
- if lang != 'xyz': # let 'en' be a language as any other and add suffix to file name
- outputfile += '.' + lang + '.html'
+ outputfile = os.path.join(outputdir,
+ 'packagelist.{0}.html'.format(lang))
with open(outputfile, 'w') as f:
try:
f.write(template.generate(**data).render('xhtml'))
--
Static and dynamic websites for Debian Pure Blends
More information about the Blends-commit
mailing list