[Piuparts-commits] [piuparts] 09/09: p-r: update_tpl(): do not create .tpl file

Holger Levsen holger at moszumanska.debian.org
Sat Mar 1 21:08:41 UTC 2014


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit fd8571c05ea26b602d26ef79d45f244436881904
Author: Andreas Beckmann <anbe at debian.org>
Date:   Sat Feb 22 16:25:54 2014 +0100

    p-r: update_tpl(): do not create .tpl file
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
---
 piuparts-report.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/piuparts-report.py b/piuparts-report.py
index f204854..778bd83 100644
--- a/piuparts-report.py
+++ b/piuparts-report.py
@@ -1508,8 +1508,7 @@ def update_tpl(basedir, section, problem, failures, logdict, ftpl, ptpl, pkgsdb)
                                    })
 
     if len(pkg_text):
-        pf = open(os.path.join(basedir, failures[0].problem[:-5] + TPL_EXT), 'w')
-        tpl_text = populate_tpl(ptpl, {
+        return populate_tpl(ptpl, {
                                 'HEADER': problem.HEADER,
                                 'SECTION': section,
                                 'HELPTEXT': problem.HELPTEXT,
@@ -1517,16 +1516,17 @@ def update_tpl(basedir, section, problem, failures, logdict, ftpl, ptpl, pkgsdb)
                                 'PACKAGE_LIST': pkg_text,
                                 'COUNT': len(failures),
                                 })
-
-        pf.write(tpl_text)
-        pf.close()
+    return ""
 
 def update_html(section, html_dir, logdict, problem_list, failures, pkgsdb):
     for problem in problem_list:
-        update_tpl(html_dir, section, problem,
+        tpl_text = update_tpl(html_dir, section, problem,
                    failures.filtered(problem.name),
                    logdict,
                    PKG_ERROR_TPL, PROB_TPL, pkgsdb)
+        if len(tpl_text):
+            with open(os.path.join(html_dir, problem.name[:-5] + TPL_EXT), 'w') as pf:
+                pf.write(tpl_text)
 
 def dwke_process_section(section, sectiondir, htmldir, problem_list, pkgsdb):
     workdirs = [os.path.join(sectiondir, x) for x in KPR_DIRS]

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list