comparison roundup/cgi/client.py @ 2042:6e708cf528e1 maint-0.6

use JS instead of 302 to redirect during rego confirmation
author Richard Jones <richard@users.sourceforge.net>
date Tue, 24 Feb 2004 23:37:10 +0000
parents 2add75e296d2
children 050ca11cc1e4
comparison
equal deleted inserted replaced
2041:2add75e296d2 2042:6e708cf528e1
1 # $Id: client.py,v 1.130.2.10 2004-02-24 21:13:26 richard Exp $ 1 # $Id: client.py,v 1.130.2.11 2004-02-24 23:37:10 richard Exp $
2 2
3 __doc__ = """ 3 __doc__ = """
4 WWW request handler (also used in the stand-alone server). 4 WWW request handler (also used in the stand-alone server).
5 """ 5 """
6 6
241 # make sure we're identified (even anonymously) 241 # make sure we're identified (even anonymously)
242 self.determine_user() 242 self.determine_user()
243 243
244 # possibly handle a form submit action (may change self.classname 244 # possibly handle a form submit action (may change self.classname
245 # and self.template, and may also append error/ok_messages) 245 # and self.template, and may also append error/ok_messages)
246 self.handle_action() 246 html = self.handle_action()
247
248 # if the action renders HTML, stop processing here
249 if html:
250 self.write(html)
251 return
247 252
248 # now render the page 253 # now render the page
249 # we don't want clients caching our dynamic pages 254 # we don't want clients caching our dynamic pages
250 self.additional_headers['Cache-Control'] = 'no-cache' 255 self.additional_headers['Cache-Control'] = 'no-cache'
251 # Pragma: no-cache makes Mozilla and its ilk double-load all pages!! 256 # Pragma: no-cache makes Mozilla and its ilk double-load all pages!!
560 if name == action: 565 if name == action:
561 break 566 break
562 else: 567 else:
563 raise ValueError, 'No such action "%s"'%action 568 raise ValueError, 'No such action "%s"'%action
564 # call the mapped action 569 # call the mapped action
565 getattr(self, method)() 570 return getattr(self, method)()
566 except Redirect: 571 except Redirect:
567 raise 572 raise
568 except Unauthorised: 573 except Unauthorised:
569 raise 574 raise
570 575
886 # new session cookie 891 # new session cookie
887 self.set_cookie(self.user) 892 self.set_cookie(self.user)
888 893
889 # nice message 894 # nice message
890 message = _('You are now registered, welcome!') 895 message = _('You are now registered, welcome!')
891 896 url = '%suser%s?@ok_message=%s'%(self.base, self.userid,
892 # redirect to the user's page 897 urllib.quote(message))
893 raise Redirect, '%suser%s?@ok_message=%s'%(self.base, 898
894 self.userid, urllib.quote(message)) 899 # redirect to the user's page (but not 302, as some email clients seem
900 # to want to reload the page, or something)
901 return '''<html><head><title>%s</title></head>
902 <body><p><a href="%s">%s</a></p>
903 <script type="text/javascript">
904 window.setTimeout('window.location = "%s"', 1000);
905 </script>'''%(message, url, message, url)
895 906
896 def passResetAction(self): 907 def passResetAction(self):
897 ''' Handle password reset requests. 908 ''' Handle password reset requests.
898 909
899 Presence of either "name" or "address" generate email. 910 Presence of either "name" or "address" generate email.

Roundup Issue Tracker: http://roundup-tracker.org/