Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 307607 Details for
Bug 410651
500 Error, not a valid package atom
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Solves the problem with 500 error
exception.patch (text/plain), 1.77 KB, created by
Slava Bacherikov
on 2012-04-03 11:48:21 UTC
(
hide
)
Description:
Solves the problem with 500 error
Filename:
MIME Type:
Creator:
Slava Bacherikov
Created:
2012-04-03 11:48:21 UTC
Size:
1.77 KB
patch
obsolete
>diff --git a/web/controller.py b/web/controller.py >index 2275733..5320d6e 100644 >--- a/web/controller.py >+++ b/web/controller.py >@@ -7,7 +7,8 @@ import cherrypy > > from web.model import latest_per_day, \ > build_centerpkg_list, \ >- get_atom >+ get_atom, \ >+ NotValidAtom > from web.lib.headers import lastmodified_httpheader, \ > lastmodified_rightcontent > from web.lib.query_filter import sanitize_query_string >@@ -380,7 +381,11 @@ class Root(object): > cat = args[0] > pn = args[1] > cpvstr = '%s/%s' % (cat, pn) >- cpvtmp = get_atom(cpvstr) >+ try: >+ cpvtmp = get_atom(cpvstr) >+ except NotValidAtom: >+ raise cherrypy.HTTPRedirect("/") >+ > pn = cpvtmp.package > cat = cpvtmp.category > pagetitle = "/package/%s/%s" % (cat, pn) >diff --git a/web/model.py b/web/model.py >index 68ce012..97c4f1d 100644 >--- a/web/model.py >+++ b/web/model.py >@@ -20,6 +20,12 @@ from web.lib.links import viewcvs_link, \ > # We use short variable names! > # pylint: disable-msg=C0103 > >+class NotValidAtom(Exception): >+ def __init__(self, value): >+ self.value = value >+ def __str__(self): >+ return repr('Not a valid package atom at all: %s' % self.value) >+ > def get_atom(cpvstr): > """Nasty hack to work around not knowing if an atom is versioned or not""" > v_atom = u_atom = None >@@ -41,7 +47,7 @@ def get_atom(cpvstr): > if u_atom: > return u_atom > >- raise Exception('Not a valid package atom at all: %s' % (cpvstr)) >+ raise NotValidAtom(cpvstr) > > def caller_name(): > """Return the name of the function that this was called from"""
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 410651
: 307607