Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 410651
Collapse All | Expand All

(-)a/web/controller.py (-2 / +7 lines)
Lines 7-13 import cherrypy Link Here
7
7
8
from web.model import latest_per_day, \
8
from web.model import latest_per_day, \
9
                      build_centerpkg_list, \
9
                      build_centerpkg_list, \
10
                      get_atom
10
                      get_atom, \
11
                      NotValidAtom
11
from web.lib.headers import lastmodified_httpheader, \
12
from web.lib.headers import lastmodified_httpheader, \
12
                            lastmodified_rightcontent
13
                            lastmodified_rightcontent
13
from web.lib.query_filter import sanitize_query_string
14
from web.lib.query_filter import sanitize_query_string
Lines 380-386 class Root(object): Link Here
380
            cat = args[0]
381
            cat = args[0]
381
            pn = args[1]
382
            pn = args[1]
382
            cpvstr = '%s/%s' % (cat, pn)
383
            cpvstr = '%s/%s' % (cat, pn)
383
            cpvtmp = get_atom(cpvstr)
384
            try:
385
                cpvtmp = get_atom(cpvstr)
386
            except NotValidAtom:
387
                raise cherrypy.HTTPRedirect("/")
388
             
384
            pn = cpvtmp.package
389
            pn = cpvtmp.package
385
            cat = cpvtmp.category
390
            cat = cpvtmp.category
386
            pagetitle = "/package/%s/%s" % (cat, pn)
391
            pagetitle = "/package/%s/%s" % (cat, pn)
(-)a/web/model.py (-1 / +7 lines)
Lines 20-25 from web.lib.links import viewcvs_link, \ Link Here
20
# We use short variable names!
20
# We use short variable names!
21
# pylint: disable-msg=C0103
21
# pylint: disable-msg=C0103
22
22
23
class NotValidAtom(Exception):
24
    def __init__(self, value):
25
         self.value = value
26
    def __str__(self):
27
         return repr('Not a valid package atom at all: %s' % self.value)
28
23
def get_atom(cpvstr):
29
def get_atom(cpvstr):
24
    """Nasty hack to work around not knowing if an atom is versioned or not"""
30
    """Nasty hack to work around not knowing if an atom is versioned or not"""
25
    v_atom = u_atom = None
31
    v_atom = u_atom = None
Lines 41-47 def get_atom(cpvstr): Link Here
41
    if u_atom:
47
    if u_atom:
42
        return u_atom 
48
        return u_atom 
43
49
44
    raise Exception('Not a valid package atom at all: %s' % (cpvstr))
50
    raise NotValidAtom(cpvstr)
45
51
46
def caller_name():
52
def caller_name():
47
    """Return the name of the function that this was called from"""
53
    """Return the name of the function that this was called from"""

Return to bug 410651