From 54a7884a275b7dcf10873651f5b28886db87dd72 Mon Sep 17 00:00:00 2001 From: Sean Finney Date: Wed, 25 Jun 2008 01:00:01 +0200 Subject: frontpage rework and quick/dirty jump form --- pagehandler.py | 12 +++++++++++- patchtracker/SourceArchive.py | 3 +-- static/css/patches.css | 3 ++- templates/frontpage.tmpl | 30 ++++++++++++++++++++---------- 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/pagehandler.py b/pagehandler.py index bbfa428..7ddeac4 100755 --- a/pagehandler.py +++ b/pagehandler.py @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- import cgi +import cgitb; cgitb.enable() import os import sys import patchtracker.Conf as Conf @@ -12,6 +13,7 @@ from patchtracker.DB import PatchTrackerDB import pygments from pygments.lexers import DiffLexer from pygments.formatters import HtmlFormatter +import patchtracker.SourceArchive as SourceArchive class CmdHandler: def __init__(self, uri): @@ -20,7 +22,7 @@ class CmdHandler: self.db = PatchTrackerDB() args = uri[len(Conf.root_url)+1:].split("/") - print "args:",args + #print "args:",args self.cmd = args[0] if self.cmd == "patch": patchtype,mode,pkgname,version = args[1:5] @@ -54,6 +56,9 @@ class CmdHandler: else: self.letter = args[1] self.toc = self.db.findLetterToc(self.letter) + elif self.cmd == "jump": + form = cgi.FieldStorage() + self.name = form.getfirst("package") elif not len(self.cmd): self.index = self.db.findMasterIndex() self.cmd = "frontpage" @@ -112,6 +117,11 @@ class CmdHandler: elif self.cmd == "frontpage": print "Content-Type: text/html\n\n" print FrontPageTemplate(self.index) + elif self.cmd == "jump": + print "Location: http://%s%s/index/%s#%s\n\n"%(os.getenv("HTTP_HOST"), + Conf.root_url, + SourceArchive.getidx(self.name), + self.name) if __name__ == "__main__": uri = os.getenv("REQUEST_URI") diff --git a/patchtracker/SourceArchive.py b/patchtracker/SourceArchive.py index 0da9fa4..c15c5f9 100755 --- a/patchtracker/SourceArchive.py +++ b/patchtracker/SourceArchive.py @@ -131,8 +131,7 @@ class MasterIndex: self.pkgcounts[idx] += 1 def indices(self): - for k,v in sorted(self.pkgcounts.iteritems()): - yield (k,v) + return sorted(self.pkgcounts.iterkeys()) class SourcePackageIndex: def __init__(self): diff --git a/static/css/patches.css b/static/css/patches.css index 15fe762..39cc8bc 100644 --- a/static/css/patches.css +++ b/static/css/patches.css @@ -30,9 +30,10 @@ td, th { padding: 10px; } -div.patch { +div.patch, div.quicklinks, div.framed { margin: 30px; padding: 15px; background-color: #eee; border: 1px solid black; } + diff --git a/templates/frontpage.tmpl b/templates/frontpage.tmpl index 5cb7fcc..17ddbd9 100644 --- a/templates/frontpage.tmpl +++ b/templates/frontpage.tmpl @@ -5,14 +5,24 @@ Debian Project patch tracking system #end def #def body

Debian Project patch tracking system

-

Browse patches by package name

- - -#for $k,$v in $allindex.indices - - - - -#end for -
index# packages
$k$v
+

Introduction

+

+ This site is used to track/visualize the changes made in the source code + of software packaged in the debian distribution. +

+

Quick access

+

Browse patches by package name

+#set $links = [ ""+k+"" for k in $allindex.indices ] +#set $out = " - ".join($links) + +

Jump to package

+
+
+ + +
+
+ #end def -- cgit v1.2.3