@@ -1335,7 +1335,7 @@ def check_anonymous_access(self):
1335
1335
if isinstance (action , list ):
1336
1336
raise SeriousError (
1337
1337
self ._ ('broken form: multiple @action values submitted' ))
1338
- elif action != '' :
1338
+ if action != '' :
1339
1339
# '' is value when no action parameter was found so run
1340
1340
# this to extract action string value when action found.
1341
1341
action = action .value .lower ()
@@ -1548,7 +1548,7 @@ def handle_csrf(self, api=False):
1548
1548
logger .error (logmsg )
1549
1549
raise Unauthorised (self ._ ("Invalid Referer: %s" ) % (
1550
1550
referer ))
1551
- elif enforce == 'logfailure' :
1551
+ if enforce == 'logfailure' :
1552
1552
logger .warning (logmsg )
1553
1553
else :
1554
1554
header_pass += 1
@@ -1567,7 +1567,7 @@ def handle_csrf(self, api=False):
1567
1567
if enforce in ('required' , 'yes' ):
1568
1568
logger .error (logmsg )
1569
1569
raise Unauthorised (self ._ ("Invalid Origin %s" % origin ))
1570
- elif enforce == 'logfailure' :
1570
+ if enforce == 'logfailure' :
1571
1571
logger .warning (logmsg )
1572
1572
else :
1573
1573
header_pass += 1
@@ -1587,7 +1587,7 @@ def handle_csrf(self, api=False):
1587
1587
logger .error (logmsg )
1588
1588
raise Unauthorised (self ._ (
1589
1589
"Invalid X-FORWARDED-HOST %s" ) % host )
1590
- elif enforce == 'logfailure' :
1590
+ if enforce == 'logfailure' :
1591
1591
logger .warning (logmsg )
1592
1592
else :
1593
1593
header_pass += 1
@@ -1611,7 +1611,7 @@ def handle_csrf(self, api=False):
1611
1611
if enforce in ('required' , 'yes' ):
1612
1612
logger .error (logmsg )
1613
1613
raise Unauthorised (self ._ ("Invalid HOST %s" ) % host )
1614
- elif enforce == 'logfailure' :
1614
+ if enforce == 'logfailure' :
1615
1615
logger .warning (logmsg )
1616
1616
else :
1617
1617
header_pass += 1
@@ -1677,7 +1677,7 @@ def handle_csrf(self, api=False):
1677
1677
raise UsageError (self ._ (
1678
1678
'' "We can't validate your session (csrf failure). "
1679
1679
'' "Re-enter any unsaved data and try again." ))
1680
- elif enforce == 'logfailure' :
1680
+ if enforce == 'logfailure' :
1681
1681
# FIXME include url
1682
1682
logger .warning (self ._ ("csrf field not supplied by user%s" ),
1683
1683
current_user )
@@ -1704,7 +1704,7 @@ def handle_csrf(self, api=False):
1704
1704
raise UsageError (self ._ (
1705
1705
'' "We can't validate your session (csrf failure). "
1706
1706
'' "Re-enter any unsaved data and try again." ))
1707
- elif enforce == 'logfailure' :
1707
+ if enforce == 'logfailure' :
1708
1708
logger .warning (logmsg )
1709
1709
1710
1710
if current_session != nonce_session :
@@ -1721,7 +1721,7 @@ def handle_csrf(self, api=False):
1721
1721
raise UsageError (self ._ (
1722
1722
'' "We can't validate your session (csrf failure). "
1723
1723
'' "Re-enter any unsaved data and try again." ))
1724
- elif enforce == 'logfailure' :
1724
+ if enforce == 'logfailure' :
1725
1725
logger .warning (logmsg )
1726
1726
1727
1727
# we are done and the change can occur.
@@ -1833,11 +1833,11 @@ def determine_context(self, dre=dre_url):
1833
1833
return
1834
1834
if path [0 ] in ('_file' , '@@file' ):
1835
1835
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 ])
1841
1841
1842
1842
# see if we got a designator
1843
1843
m = dre .match (self .classname )
@@ -1974,9 +1974,9 @@ def serve_static_file(self, file):
1974
1974
filename = os .path .normpath (os .path .join (p , file ))
1975
1975
if os .path .isfile (filename ) and filename .startswith (p ):
1976
1976
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
1980
1980
1981
1981
# break out of outer loop over options
1982
1982
if filename :
@@ -2344,8 +2344,8 @@ def handle_action(self):
2344
2344
if isinstance (action , list ):
2345
2345
raise SeriousError (
2346
2346
self ._ ('broken form: multiple @action values submitted' ))
2347
- else :
2348
- action = action .value .lower ()
2347
+
2348
+ action = action .value .lower ()
2349
2349
2350
2350
try :
2351
2351
action_klass = self .get_action_class (action )
@@ -2354,8 +2354,8 @@ def handle_action(self):
2354
2354
if isinstance (action_klass , type ('' )):
2355
2355
# old way of specifying actions
2356
2356
return getattr (self , action_klass )()
2357
- else :
2358
- return action_klass (self ).execute ()
2357
+
2358
+ return action_klass (self ).execute ()
2359
2359
except (ValueError , Reject ) as err :
2360
2360
escape = not isinstance (err , RejectRaw )
2361
2361
self .add_error_message (str (err ), escape = escape )
@@ -2420,8 +2420,8 @@ def determine_content_encoding(self, list_all=False, precompressed=False):
2420
2420
(enc in accept_encoding ):
2421
2421
if not list_all :
2422
2422
return enc
2423
- else :
2424
- encoding_list .append (enc )
2423
+
2424
+ encoding_list .append (enc )
2425
2425
2426
2426
# Return value must evaluate to false in boolean context if no
2427
2427
# acceptable encoding is found. If an (non-identity) encoding
@@ -2430,8 +2430,7 @@ def determine_content_encoding(self, list_all=False, precompressed=False):
2430
2430
# Maybe raise a 406 from here?
2431
2431
if not list_all :
2432
2432
return None
2433
- else :
2434
- return encoding_list
2433
+ return encoding_list
2435
2434
2436
2435
def setVary (self , header ):
2437
2436
'''Vary header will include the new header. This will append
0 commit comments