diff options
author | Sean Finney <seanius@debian.org> | 2010-05-13 19:49:09 +0200 |
---|---|---|
committer | Sean Finney <seanius@debian.org> | 2010-05-13 19:49:09 +0200 |
commit | 4a87687ce6598d89c9368d45f8f570d86c6c665e (patch) | |
tree | ca700ea35f91fa7e5c4fb5b8a2a5ac7408be0f3e | |
parent | 01c7296bf73da53a8d2d3feccb700e1e1e570fa0 (diff) | |
download | patch-tracker-4a87687ce6598d89c9368d45f8f570d86c6c665e.tar.gz |
More dead code removal
-rwxr-xr-x | patchtracker/ReqHandler.py | 39 | ||||
-rwxr-xr-x | patchtracker/Templates.py | 11 |
2 files changed, 1 insertions, 49 deletions
diff --git a/patchtracker/ReqHandler.py b/patchtracker/ReqHandler.py index ca81be7..844e108 100755 --- a/patchtracker/ReqHandler.py +++ b/patchtracker/ReqHandler.py @@ -9,9 +9,6 @@ from patchtracker.Templates import ErrorTemplate, LetterTocTemplate, FrontPageTe from patchtracker.CacheObject import CacheObject, CacheMissException import patchtracker.DB as DB from patchtracker.DB import PatchTrackerDB -import pygments -from pygments.lexers import DiffLexer -from pygments.formatters import HtmlFormatter import patchtracker.SourceArchive as SourceArchive class ReqHandlerException(Exception): @@ -33,36 +30,6 @@ class ErrorCmd(Cmd): def output(self): return str(ErrorTemplate(self.msg)) -class PackageCmd(Cmd): - def __init__(self, args): - Cmd.__init__(self) - db = PatchTrackerDB() - self.name = args[0] - if len(args) > 1: - version = args[1] - else: - version = None - self.toc = db.findCollection(package=self.name, version=version) - - # if there's no match, try with a wildcard match - if not self.toc.size(): - # ... but don't allow pathologically short names - if len(self.name) < 3: - raise ReqHandlerException("search terms must be 3 or more letters...") - else: - self.toc = db.findCollection(package="%"+self.name+"%", version=version) - - plist = self.toc.getletter(self.name) - if not plist or len(plist) == 0: - raise ReqHandlerException("can't find any package named or containing '%s'"%self.name, code="404 ENOPKG kthxbye") - - def output(self): - p = self.toc.getpackage(self.name) - # if there is no match, or if multiple versions were returned - if not p or len(set(map(lambda x: x.version, p.values()))) > 1: - querydesc = "package name contains" - return str(SearchResultsTemplate(self.name, querydesc, self.toc)) - class IndexCmd(Cmd): def __init__(self, args): Cmd.__init__(self) @@ -119,11 +86,7 @@ class CmdHandler: args = uri[len(Conf.root_url)+1:].split("/") cmdarg = args[0] cacheable = False - if cmdarg == "package": - self.cmd = PackageCmd(args[1:]) - if len(args[1:]) > 1: - cacheable = True - elif cmdarg == "index": + if cmdarg == "index": self.cmd = IndexCmd(args[1:]) elif cmdarg == "jump": self.cmd = JumpCmd(env) diff --git a/patchtracker/Templates.py b/patchtracker/Templates.py index bb93eae..ea6667a 100755 --- a/patchtracker/Templates.py +++ b/patchtracker/Templates.py @@ -24,16 +24,6 @@ class FrontPageTemplate(OurTemplate): OurTemplate.__init__(self, file=tpl) self.indices = indices -class LetterTocTemplate(OurTemplate): - def __init__(self, letter, collection): - self.pkgs = collection - self.idx = letter - self.dists = ReleaseList("debian") - sl = {} - sl['crumbs'] = [("index/"+letter,"index for "+letter)] - tpl = os.sep.join([Conf.template_dir, "letter_toc.tmpl"]) - OurTemplate.__init__(self, file=tpl, searchList=sl) - class SearchResultsTemplate(OurTemplate): def __init__(self, search, searchtype, collection): self.pkgs = {} @@ -46,7 +36,6 @@ class SearchResultsTemplate(OurTemplate): tpl = os.sep.join([Conf.template_dir, "searchresults.tmpl"]) OurTemplate.__init__(self, file=tpl) - class ErrorTemplate(OurTemplate): def __init__(self, msg): tpl = os.sep.join([Conf.template_dir, "cgi_error.tmpl"]) |