summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Finney <seanius@debian.org>2008-06-10 08:01:01 +0200
committerSean Finney <seanius@debian.org>2008-06-10 08:01:01 +0200
commitfa267c182130bd52852fcfa250d82835e1006ac5 (patch)
tree4af300bba2f7564221cb2447879d9b7f9fc7a295
parent23535ad4675885ca7358e2eed42a1481651daaac (diff)
downloadpatch-tracker-fa267c182130bd52852fcfa250d82835e1006ac5.tar.gz
add a DiffGzHandler to the PackageVers template
-rwxr-xr-xpatchtracker/Writers.py19
1 files 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: