summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5e02838)
raw | patch | inline | side by side (parent: 5e02838)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 25 Feb 2004 23:27:54 +0000 (23:27 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 25 Feb 2004 23:27:54 +0000 (23:27 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2121 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/cgi/actions.py | patch | blob | history | |
roundup/cgi/client.py | patch | blob | history | |
roundup/cgi/exceptions.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index 60abfcbed0ba1281bcfebd2669c5791f676e19e5..2cc96571d6e8ec08f668d3f32003b2b7a19d694c 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
Fixed:
- made error on create consistent with edit when user enters invalid data
for Multilink and Link form fields (sf bug 904072)
+- made errors from bad input in the quick "Show issue:" form more
+ user-friendly (sf bug 904064)
2004-02-25 0.6.6
diff --git a/roundup/cgi/actions.py b/roundup/cgi/actions.py
index ceb89bb8344443d962e1e3a98c7a276222b7acb8..1f57ff8e63b14aa0852befa329b82fbb3fa43893 100755 (executable)
--- a/roundup/cgi/actions.py
+++ b/roundup/cgi/actions.py
from roundup import hyperdb, token, date, password, rcsv
from roundup.i18n import _
from roundup.cgi import templating
-from roundup.cgi.exceptions import Redirect, Unauthorised
+from roundup.cgi.exceptions import Redirect, Unauthorised, SeriousError
from roundup.mailgw import uidFromAddress
__all__ = ['Action', 'ShowAction', 'RetireAction', 'SearchAction',
elif numre.match(key):
n = self.form[key].value.strip()
if not t:
- raise ValueError, 'Invalid %s number'%t
+ raise ValueError, 'No type specified'
+ if not n:
+ raise SeriousError, _('No ID entered')
+ try:
+ int(n)
+ except ValueError:
+ d = {'input': n, 'classname': t}
+ raise SeriousError, _(
+ '"%(input)s" is not an ID (%(classname)s ID required)')%d
url = '%s%s%s'%(self.db.config.TRACKER_WEB, t, n)
raise Redirect, url
# generate the one-time-key and store the props for later
otk = ''.join([random.choice(chars) for x in range(32)])
- self.db.otks.set(otk, uid=uid, __time=time.time())
+ d = {'uid': uid, self.db.otks.timestamp: time.time()}
+ self.db.otks.set(otk, **d)
# send the email
tracker_name = self.db.config.TRACKER_NAME
Return 1 on successful login.
"""
- props = self.client.parsePropsFromForm(create=1)[0][('user', None)]
+ props = self.client.parsePropsFromForm(create=True)[0][('user', None)]
# registration isn't allowed to supply roles
if props.has_key('roles'):
props[propname] = str(value)
elif isinstance(proptype, hyperdb.Password):
props[propname] = str(value)
- props['__time'] = time.time()
+ props[self.db.otks.timestamp] = time.time()
self.db.otks.set(otk, **props)
# send the email
diff --git a/roundup/cgi/client.py b/roundup/cgi/client.py
index 5c31b774fe5e2e674cdae96d54a5c3aec85dbd32..d96aa168258a13532244194fd88ef6eabc16a394 100644 (file)
--- a/roundup/cgi/client.py
+++ b/roundup/cgi/client.py
-# $Id: client.py,v 1.164 2004-02-25 03:39:53 richard Exp $
+# $Id: client.py,v 1.165 2004-02-25 23:27:54 richard Exp $
"""WWW request handler (also used in the stand-alone server).
"""
# render the content
self.write(self.renderContext())
+ except SeriousError, message:
+ self.write(str(message))
except Redirect, url:
# let's redirect - if the url isn't None, then we need to do
# the headers, otherwise the headers have been set before the
index 1ae37e1b89d87b5eaccc2761d3ac7aa9f3987d57..0b3fe932bc7e2c094271da79dd077130b1b27ce3 100755 (executable)
class SendStaticFile(Exception):
"""Send a static file from the instance html directory."""
+
+class SeriousError(Exception):
+ """Raised when we can't reasonably display an error message on a
+ templated page.
+
+ The exception value will be displayed in the error page, HTML
+ escaped.
+ """
+ def __str__(self):
+ return '''
+<html><head><title>Roundup issue tracker: An error has occurred</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8;">
+ <link rel="stylesheet" type="text/css" href="_file/style.css">
+</head>
+<body class="body" marginwidth="0" marginheight="0">
+ <p class="error-message">%s</p>
+</body></html>
+'''%cgi.escape(self.args[0])
+