The following commit has been merged in the master branch:
commit 3f361d50736068d83d091bd785bac5b74e75517b
Author: Ole Streicher <oleb...@debian.org>
Date:   Mon Jan 11 09:06:19 2016 +0100

    Remove unlink() calls: existing files are automatically truncated when 
open('w')ed

diff --git a/webtools_py3/tasks_udd.py b/webtools_py3/tasks_udd.py
index a0305e2..772347d 100755
--- a/webtools_py3/tasks_udd.py
+++ b/webtools_py3/tasks_udd.py
@@ -75,10 +75,6 @@ if outputdir == None:
 
 t = datetime.now()
 htaccess = outputdir + '/.htaccess'
-try:
-       os.unlink(htaccess)
-except: # simply continue if file does not exist
-       pass
 htafp = open(htaccess, 'w')
 htafp.write("DirectoryIndex index index.html\nOptions +MultiViews\n")
 
@@ -179,10 +175,6 @@ for lang in languages:
     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'
-    try:
-        os.unlink(outputfile)
-    except: # simply continue if file does not exist
-           pass
     with open(outputfile, 'w') as f:
         try:
            f.write(template.generate(**data).render('xhtml'))
@@ -195,10 +187,6 @@ for lang in languages:
         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
         with open(outputfile, 'w') as f:
             try:
                 f.write(template.generate(**data).render('xhtml'))
@@ -252,10 +240,6 @@ for lang in languages:
         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'
-        try:
-            os.unlink(outputfile)
-        except: # simply continue if file does not exist
-            pass
 
         if data['projectname'] == 'Debian Astro':
             template = loader.load('packages.xhtml')
@@ -293,10 +277,6 @@ for lang in languages:
     outputfile = outputdir + '/packagelist'
     if lang != 'xyz': # let 'en' be a language as any other and add suffix to 
file name
         outputfile += '.' + lang + '.html'
-    try:
-        os.unlink(outputfile)
-    except: # simply continue if file does not exist
-        pass
     with open(outputfile, 'w') as f:
         try:
             f.write(template.generate(**data).render('xhtml'))

-- 
Static and dynamic websites for Debian Pure Blends

_______________________________________________
Blends-commit mailing list
Blends-commit@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/blends-commit

Reply via email to