33from roundup import hyperdb , token , date , password
44from roundup .actions import Action as BaseAction
55from roundup .i18n import _
6- import roundup .exceptions
76from roundup .cgi import exceptions , templating
87from roundup .mailgw import uidFromAddress
8+ from roundup .exceptions import Reject , RejectRaw
99from roundup .anypy import io_ , urllib_
1010
1111__all__ = ['Action' , 'ShowAction' , 'RetireAction' , 'SearchAction' ,
@@ -106,7 +106,7 @@ def handle(self):
106106 """Retire the context item."""
107107 # ensure modification comes via POST
108108 if self .client .env ['REQUEST_METHOD' ] != 'POST' :
109- raise roundup . exceptions . Reject (self ._ ('Invalid request' ))
109+ raise Reject (self ._ ('Invalid request' ))
110110
111111 # if we want to view the index template now, then unset the itemid
112112 # context info (a special-case for retire actions on the index page)
@@ -285,7 +285,7 @@ def handle(self):
285285 """
286286 # ensure modification comes via POST
287287 if self .client .env ['REQUEST_METHOD' ] != 'POST' :
288- raise roundup . exceptions . Reject (self ._ ('Invalid request' ))
288+ raise Reject (self ._ ('Invalid request' ))
289289
290290 # figure the properties list for the class
291291 cl = self .db .classes [self .classname ]
@@ -606,7 +606,7 @@ def handle(self):
606606 """
607607 # ensure modification comes via POST
608608 if self .client .env ['REQUEST_METHOD' ] != 'POST' :
609- raise roundup . exceptions . Reject (self ._ ('Invalid request' ))
609+ raise Reject (self ._ ('Invalid request' ))
610610
611611 user_activity = self .lastUserActivity ()
612612 if user_activity :
@@ -620,10 +620,10 @@ def handle(self):
620620 # handle the props
621621 try :
622622 message = self ._editnodes (props , links )
623- except (ValueError , KeyError , IndexError ,
624- roundup . exceptions . Reject ), message :
623+ except (ValueError , KeyError , IndexError , Reject ) as message :
624+ escape = not isinstance ( message , RejectRaw )
625625 self .client .add_error_message (
626- self ._ ('Edit Error: %s' ) % str (message ))
626+ self ._ ('Edit Error: %s' ) % str (message ), escape = escape )
627627 return
628628
629629 # commit now that all the tricky stuff is done
@@ -652,7 +652,7 @@ def handle(self):
652652 '''
653653 # ensure modification comes via POST
654654 if self .client .env ['REQUEST_METHOD' ] != 'POST' :
655- raise roundup . exceptions . Reject (self ._ ('Invalid request' ))
655+ raise Reject (self ._ ('Invalid request' ))
656656
657657 # parse the props from the form
658658 try :
@@ -666,10 +666,11 @@ def handle(self):
666666 try :
667667 # when it hits the None element, it'll set self.nodeid
668668 messages = self ._editnodes (props , links )
669- except (ValueError , KeyError , IndexError ,
670- roundup . exceptions . Reject ), message :
669+ except (ValueError , KeyError , IndexError , Reject ) as message :
670+ escape = not isinstance ( message , RejectRaw )
671671 # these errors might just be indicative of user dumbness
672- self .client .add_error_message (_ ('Error: %s' ) % str (message ))
672+ self .client .add_error_message (_ ('Error: %s' ) % str (message ),
673+ escape = escape )
673674 return
674675
675676 # commit now that all the tricky stuff is done
@@ -833,7 +834,7 @@ def handle(self):
833834 """
834835 # ensure modification comes via POST
835836 if self .client .env ['REQUEST_METHOD' ] != 'POST' :
836- raise roundup . exceptions . Reject (self ._ ('Invalid request' ))
837+ raise Reject (self ._ ('Invalid request' ))
837838
838839 # parse the props from the form
839840 try :
@@ -849,10 +850,11 @@ def handle(self):
849850 try :
850851 # when it hits the None element, it'll set self.nodeid
851852 messages = self ._editnodes (props , links )
852- except (ValueError , KeyError , IndexError ,
853- roundup . exceptions . Reject ), message :
853+ except (ValueError , KeyError , IndexError , Reject ) as message :
854+ escape = not isinstance ( message , RejectRaw )
854855 # these errors might just be indicative of user dumbness
855- self .client .add_error_message (_ ('Error: %s' ) % str (message ))
856+ self .client .add_error_message (_ ('Error: %s' ) % str (message ),
857+ escape = escape )
856858 return
857859
858860 # fix up the initial roles
@@ -957,7 +959,7 @@ def handle(self):
957959 """
958960 # ensure modification comes via POST
959961 if self .client .env ['REQUEST_METHOD' ] != 'POST' :
960- raise roundup . exceptions . Reject (self ._ ('Invalid request' ))
962+ raise Reject (self ._ ('Invalid request' ))
961963
962964 # we need the username at a minimum
963965 if '__login_name' not in self .form :
0 commit comments