From fa267c182130bd52852fcfa250d82835e1006ac5 Mon Sep 17 00:00:00 2001 From: Sean Finney Date: Tue, 10 Jun 2008 08:01:01 +0200 Subject: add a DiffGzHandler to the PackageVers template --- patchtracker/Writers.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/patchtracker/Writers.py b/patchtracker/Writers.py index 15c3fa1..74dd95d 100755 --- a/patchtracker/Writers.py +++ b/patchtracker/Writers.py @@ -1,4 +1,5 @@ from patchtracker import Conf +from patchtracker.DiffGzHandler import DiffGzHandler from Cheetah.Template import Template from Cheetah.Compiler import Compiler @@ -6,8 +7,12 @@ import os import errno class OurTemplate(Template): - def __init__(self, file): - Template.__init__(self, file=file, searchList={"conf":Conf}) + def __init__(self, file, searchList=None): + ourSearchList={"conf":Conf} + if searchList: + for k,v in searchList.iteritems(): + ourSearchList[k]=v + Template.__init__(self, file=file, searchList=ourSearchList) class PackageVersTemplate(OurTemplate): src = None @@ -17,7 +22,13 @@ class PackageVersTemplate(OurTemplate): self.src = srcpkg self.suite = suite tpl=os.sep.join([Conf.template_dir, "package_vers.tmpl"]) - OurTemplate.__init__(self, file=tpl) + sl = {} + if srcpkg.diffgz: + dfile = os.sep.join([Conf.archive_root,srcpkg.loc,srcpkg.diffgz['name']]) + sl['diffhandler'] = DiffGzHandler(dfile) + else: + sl['diffhandler'] = None + OurTemplate.__init__(self, file=tpl, searchList=sl) class FrontPageTemplate(OurTemplate): allindex = None @@ -61,7 +72,7 @@ class PageWriter: class PackageVersWriter(PageWriter): def __init__(self, srcpkg, suite): t = PackageVersTemplate(srcpkg,suite) - dstdir = os.sep.join([Conf.output_dir, "packages", t.src.name, t.src.version]) + dstdir = os.sep.join([Conf.output_dir, "package", t.src.name, t.src.version]) try: os.makedirs(dstdir) except OSError, e: -- cgit v1.2.3