@@ -1335,7 +1335,7 @@ def check_anonymous_access(self):
13351335 if isinstance (action , list ):
13361336 raise SeriousError (
13371337 self ._ ('broken form: multiple @action values submitted' ))
1338- elif action != '' :
1338+ if action != '' :
13391339 # '' is value when no action parameter was found so run
13401340 # this to extract action string value when action found.
13411341 action = action .value .lower ()
@@ -1548,7 +1548,7 @@ def handle_csrf(self, api=False):
15481548 logger .error (logmsg )
15491549 raise Unauthorised (self ._ ("Invalid Referer: %s" ) % (
15501550 referer ))
1551- elif enforce == 'logfailure' :
1551+ if enforce == 'logfailure' :
15521552 logger .warning (logmsg )
15531553 else :
15541554 header_pass += 1
@@ -1567,7 +1567,7 @@ def handle_csrf(self, api=False):
15671567 if enforce in ('required' , 'yes' ):
15681568 logger .error (logmsg )
15691569 raise Unauthorised (self ._ ("Invalid Origin %s" % origin ))
1570- elif enforce == 'logfailure' :
1570+ if enforce == 'logfailure' :
15711571 logger .warning (logmsg )
15721572 else :
15731573 header_pass += 1
@@ -1587,7 +1587,7 @@ def handle_csrf(self, api=False):
15871587 logger .error (logmsg )
15881588 raise Unauthorised (self ._ (
15891589 "Invalid X-FORWARDED-HOST %s" ) % host )
1590- elif enforce == 'logfailure' :
1590+ if enforce == 'logfailure' :
15911591 logger .warning (logmsg )
15921592 else :
15931593 header_pass += 1
@@ -1611,7 +1611,7 @@ def handle_csrf(self, api=False):
16111611 if enforce in ('required' , 'yes' ):
16121612 logger .error (logmsg )
16131613 raise Unauthorised (self ._ ("Invalid HOST %s" ) % host )
1614- elif enforce == 'logfailure' :
1614+ if enforce == 'logfailure' :
16151615 logger .warning (logmsg )
16161616 else :
16171617 header_pass += 1
@@ -1677,7 +1677,7 @@ def handle_csrf(self, api=False):
16771677 raise UsageError (self ._ (
16781678 '' "We can't validate your session (csrf failure). "
16791679 '' "Re-enter any unsaved data and try again." ))
1680- elif enforce == 'logfailure' :
1680+ if enforce == 'logfailure' :
16811681 # FIXME include url
16821682 logger .warning (self ._ ("csrf field not supplied by user%s" ),
16831683 current_user )
@@ -1704,7 +1704,7 @@ def handle_csrf(self, api=False):
17041704 raise UsageError (self ._ (
17051705 '' "We can't validate your session (csrf failure). "
17061706 '' "Re-enter any unsaved data and try again." ))
1707- elif enforce == 'logfailure' :
1707+ if enforce == 'logfailure' :
17081708 logger .warning (logmsg )
17091709
17101710 if current_session != nonce_session :
@@ -1721,7 +1721,7 @@ def handle_csrf(self, api=False):
17211721 raise UsageError (self ._ (
17221722 '' "We can't validate your session (csrf failure). "
17231723 '' "Re-enter any unsaved data and try again." ))
1724- elif enforce == 'logfailure' :
1724+ if enforce == 'logfailure' :
17251725 logger .warning (logmsg )
17261726
17271727 # we are done and the change can occur.
@@ -1833,11 +1833,11 @@ def determine_context(self, dre=dre_url):
18331833 return
18341834 if path [0 ] in ('_file' , '@@file' ):
18351835 raise SendStaticFile (os .path .join (* path [1 :]))
1836- else :
1837- self .classname = path [0 ]
1838- if len (path ) > 1 :
1839- # send the file identified by the designator in path[0]
1840- raise SendFile (path [0 ])
1836+
1837+ self .classname = path [0 ]
1838+ if len (path ) > 1 :
1839+ # send the file identified by the designator in path[0]
1840+ raise SendFile (path [0 ])
18411841
18421842 # see if we got a designator
18431843 m = dre .match (self .classname )
@@ -1974,9 +1974,9 @@ def serve_static_file(self, file):
19741974 filename = os .path .normpath (os .path .join (p , file ))
19751975 if os .path .isfile (filename ) and filename .startswith (p ):
19761976 break # inner loop over list of directories
1977- else :
1978- # reset filename to None as sentinel for use below.
1979- filename = None
1977+
1978+ # reset filename to None as sentinel for use below.
1979+ filename = None
19801980
19811981 # break out of outer loop over options
19821982 if filename :
@@ -2344,8 +2344,8 @@ def handle_action(self):
23442344 if isinstance (action , list ):
23452345 raise SeriousError (
23462346 self ._ ('broken form: multiple @action values submitted' ))
2347- else :
2348- action = action .value .lower ()
2347+
2348+ action = action .value .lower ()
23492349
23502350 try :
23512351 action_klass = self .get_action_class (action )
@@ -2354,8 +2354,8 @@ def handle_action(self):
23542354 if isinstance (action_klass , type ('' )):
23552355 # old way of specifying actions
23562356 return getattr (self , action_klass )()
2357- else :
2358- return action_klass (self ).execute ()
2357+
2358+ return action_klass (self ).execute ()
23592359 except (ValueError , Reject ) as err :
23602360 escape = not isinstance (err , RejectRaw )
23612361 self .add_error_message (str (err ), escape = escape )
@@ -2420,8 +2420,8 @@ def determine_content_encoding(self, list_all=False, precompressed=False):
24202420 (enc in accept_encoding ):
24212421 if not list_all :
24222422 return enc
2423- else :
2424- encoding_list .append (enc )
2423+
2424+ encoding_list .append (enc )
24252425
24262426 # Return value must evaluate to false in boolean context if no
24272427 # acceptable encoding is found. If an (non-identity) encoding
@@ -2430,8 +2430,7 @@ def determine_content_encoding(self, list_all=False, precompressed=False):
24302430 # Maybe raise a 406 from here?
24312431 if not list_all :
24322432 return None
2433- else :
2434- return encoding_list
2433+ return encoding_list
24352434
24362435 def setVary (self , header ):
24372436 '''Vary header will include the new header. This will append
0 commit comments