1- # $Id: client.py,v 1.162 2004-02-20 03:48:16 richard Exp $
1+ # $Id: client.py,v 1.163 2004-02-25 03:24:43 richard Exp $
22
33"""WWW request handler (also used in the stand-alone server).
44"""
@@ -190,7 +190,11 @@ def inner_main(self):
190190
191191 # possibly handle a form submit action (may change self.classname
192192 # and self.template, and may also append error/ok_messages)
193- self .handle_action ()
193+ html = self .handle_action ()
194+
195+ if html :
196+ self .write (html )
197+ return
194198
195199 # now render the page
196200 # we don't want clients caching our dynamic pages
@@ -538,6 +542,9 @@ def handle_action(self):
538542 The action is defined by the form variable :action which
539543 identifies the method on this object to call. The actions
540544 are defined in the "actions" sequence on this class.
545+
546+ Actions may return a page (by default HTML) to return to the
547+ user, bypassing the usual template rendering.
541548 '''
542549 if self .form .has_key (':action' ):
543550 action = self .form [':action' ].value .lower ()
@@ -556,9 +563,9 @@ def handle_action(self):
556563 # call the mapped action
557564 if isinstance (action_klass , type ('' )):
558565 # old way of specifying actions
559- getattr (self , action_klass )()
566+ return getattr (self , action_klass )()
560567 else :
561- action_klass (self ).execute ()
568+ return action_klass (self ).execute ()
562569
563570 except ValueError , err :
564571 self .error_message .append (str (err ))
0 commit comments