summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Finney <seanius@debian.org>2008-06-02 20:17:52 +0200
committerSean Finney <seanius@debian.org>2008-06-02 20:17:52 +0200
commit9d68e03bca4229a43ad64c13283c730fb091de53 (patch)
treeb3a023e906345113e8f6b8368ea40e1cab10cf6c
parent72f19903ae8c7e07b26f1625e957bb07395fb260 (diff)
downloadpatch-tracker-9d68e03bca4229a43ad64c13283c730fb091de53.tar.gz
rework templates to use inheritance
also added a gitignore file to ignore the python noise created by cheetah
-rw-r--r--.gitignore3
-rwxr-xr-xgen-patch-info.py6
-rw-r--r--templates/__init__.py0
-rw-r--r--templates/frontpage.tmpl19
-rw-r--r--templates/letter_toc.tmpl (renamed from templates/letter-toc.tmpl)17
-rwxr-xr-xtemplates/package_vers.tmpl (renamed from templates/package-vers.tmpl)18
-rw-r--r--templates/skeleton.tmpl11
7 files changed, 40 insertions, 34 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3f83bf1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+templates/skeleton.py
+templates/*.pyc
+templates/*.py.bak
diff --git a/gen-patch-info.py b/gen-patch-info.py
index 2a22c9f..59c56eb 100755
--- a/gen-patch-info.py
+++ b/gen-patch-info.py
@@ -8,6 +8,7 @@ from fnmatch import fnmatch
from gzip import GzipFile
from debian_bundle import deb822
from Cheetah.Template import Template
+from Cheetah.Compiler import Compiler
class Conf:
archive_root = '/scratch/debian-archive/debian'
@@ -148,7 +149,7 @@ class PackageVersTemplate(OurTemplate):
def __init__(self, srcpkg, suite):
self.src = srcpkg
self.suite = suite
- tpl=os.sep.join([Conf.template_dir, "package-vers.tmpl"])
+ tpl=os.sep.join([Conf.template_dir, "package_vers.tmpl"])
OurTemplate.__init__(self, file=tpl)
class PackageVersWriter(PageWriter):
@@ -211,7 +212,7 @@ class LetterTocTemplate(OurTemplate):
for name,packagelist in collection.iteritems():
for d in packagelist.iterkeys():
self.dists[d] = True
- tpl = os.sep.join([Conf.template_dir, "letter-toc.tmpl"])
+ tpl = os.sep.join([Conf.template_dir, "letter_toc.tmpl"])
OurTemplate.__init__(self, file=tpl)
class LetterTocWriter(PageWriter):
@@ -221,6 +222,7 @@ class LetterTocWriter(PageWriter):
PageWriter.__init__(self, dest, template)
if __name__ == '__main__':
+ os.system("cheetah compile templates/skeleton")
a = Archive(Conf.archive_root)
# just for now until development stablizes
diff --git a/templates/__init__.py b/templates/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/templates/__init__.py
diff --git a/templates/frontpage.tmpl b/templates/frontpage.tmpl
index 6bf9b34..e283f98 100644
--- a/templates/frontpage.tmpl
+++ b/templates/frontpage.tmpl
@@ -1,17 +1,14 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
- <head>
- <title> Debian Project patch tracking system </title>
- <link rel="stylesheet" type="text/css" href="$conf.root_url/css/patches.css"/>
- </head>
-<body>
+#import templates
+#extends templates.skeleton
+#def title
+Debian Project patch tracking system
+#end def
+#def body
<h1>Debian Project patch tracking system</h1>
- <h2>Browse patches by package name</h2>
+ <h2>Browse patches by package name</h2>
#for $k in $allindex.pkgs.iterkeys()
#if $allindex.pkgs[$k]
<a href="index/$k">$k</a>
#end if
#end for
- </body>
-</html>
+#end def
diff --git a/templates/letter-toc.tmpl b/templates/letter_toc.tmpl
index e25cd4d..0f2ba02 100644
--- a/templates/letter-toc.tmpl
+++ b/templates/letter_toc.tmpl
@@ -1,11 +1,9 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
- <head>
- <title>Debian Project patch tracking system</title>
- <link rel="stylesheet" type="text/css" href="$conf.root_url/css/patches.css"/>
- </head>
-<body>
+#import templates
+#extends templates.skeleton
+#def title
+Debian Project patch tracking system
+#end def
+#def body
<h1>Debian Project patch tracking system</h1>
<h2>Packaging patches by index - $idx</h2>
<table class="packagelisting">
@@ -28,5 +26,4 @@
</tr>
#end for
</table>
-</body>
-</html>
+#end def
diff --git a/templates/package-vers.tmpl b/templates/package_vers.tmpl
index 17689c7..348c389 100755
--- a/templates/package-vers.tmpl
+++ b/templates/package_vers.tmpl
@@ -1,12 +1,9 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
- <head>
- <title>debian specific patch information for $src.name / $suite</title>
- <link rel="stylesheet" type="text/css" href="$conf.root_url/css/patches.css"/>
- </head>
-
- <body>
+#import templates
+#extends templates.skeleton
+#def title
+debian specific patch information for $src.name / $suite
+#end def
+#def body
<h1>debian specific patch information for $src.name / $suite</h1>
<h2> Summary </h2>
<table class="summary">
@@ -92,5 +89,4 @@
#end for
</table>
#end if
- </body>
-</html>
+#end def
diff --git a/templates/skeleton.tmpl b/templates/skeleton.tmpl
new file mode 100644
index 0000000..cd4ff12
--- /dev/null
+++ b/templates/skeleton.tmpl
@@ -0,0 +1,11 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+ <head>
+ <title>$title</title>
+ <link rel="stylesheet" type="text/css" href="$conf.root_url/css/patches.css"/>
+ </head>
+ <body>
+ $body
+ </body>
+</html>