Code

Forward-porting of fixes from the maintenance branch.
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Wed, 25 Feb 2004 03:24:43 +0000 (03:24 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Wed, 25 Feb 2004 03:24:43 +0000 (03:24 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2114 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/cgi/actions.py
roundup/cgi/client.py

index 36a4d9dc1b1127b3c3d217eaa3bfde3b319a298f..ceb89bb8344443d962e1e3a98c7a276222b7acb8 100755 (executable)
@@ -637,10 +637,16 @@ class ConfRegoAction(Action):
 
         # nice message
         message = _('You are now registered, welcome!')
-
-        # redirect to the user's page
-        raise Redirect, '%suser%s?@ok_message=%s'%(self.base,
-            self.userid, urllib.quote(message))
+        url = '%suser%s?@ok_message=%s'%(self.base, self.userid,
+            urllib.quote(message))
+
+        # redirect to the user's page (but not 302, as some email clients seem
+        # to want to reload the page, or something)
+        return '''<html><head><title>%s</title></head>
+            <body><p><a href="%s">%s</a></p>
+            <script type="text/javascript">
+            window.setTimeout('window.location = "%s"', 1000);
+            </script>'''%(message, url, message, url)
 
 class RegisterAction(Action):
     name = 'register'
index 4a2a78d1fa4f0d01c6e8b7b88a7c945184571d1d..57fdd110c9ca6a4bd0a4bdb93b33257899b2c5f1 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: client.py,v 1.162 2004-02-20 03:48:16 richard Exp $
+# $Id: client.py,v 1.163 2004-02-25 03:24:43 richard Exp $
 
 """WWW request handler (also used in the stand-alone server).
 """
@@ -190,7 +190,11 @@ class Client:
 
             # possibly handle a form submit action (may change self.classname
             # and self.template, and may also append error/ok_messages)
-            self.handle_action()
+            html = self.handle_action()
+
+            if html:
+                self.write(html)
+                return
 
             # now render the page
             # we don't want clients caching our dynamic pages
@@ -538,6 +542,9 @@ class Client:
             The action is defined by the form variable :action which
             identifies the method on this object to call. The actions
             are defined in the "actions" sequence on this class.
+
+            Actions may return a page (by default HTML) to return to the
+            user, bypassing the usual template rendering.
         '''
         if self.form.has_key(':action'):
             action = self.form[':action'].value.lower()
@@ -556,9 +563,9 @@ class Client:
             # call the mapped action
             if isinstance(action_klass, type('')):
                 # old way of specifying actions
-                getattr(self, action_klass)()
+                return getattr(self, action_klass)()
             else:
-                action_klass(self).execute()
+                return action_klass(self).execute()
 
         except ValueError, err:
             self.error_message.append(str(err))