|
a/Allura/allura/lib/utils.py |
|
b/Allura/allura/lib/utils.py |
|
... |
|
... |
239 |
return params
|
239 |
return params
|
240 |
|
240 |
|
241 |
@classmethod
|
241 |
@classmethod
|
242 |
def validate(cls, error_msg):
|
242 |
def validate(cls, error_msg):
|
243 |
'''Controller decorator to raise Invalid errors if bot protection is engaged'''
|
243 |
'''Controller decorator to raise Invalid errors if bot protection is engaged'''
|
244 |
def hook(remainder, params):
|
244 |
def antispam_hook(remainder, params):
|
245 |
'''Converts various errors in validate_request to a single Invalid message'''
|
245 |
'''Converts various errors in validate_request to a single Invalid message'''
|
246 |
try:
|
246 |
try:
|
247 |
params.update(cls.validate_request())
|
247 |
params.update(cls.validate_request())
|
248 |
except (ValueError, TypeError, binascii.Error):
|
248 |
except (ValueError, TypeError, binascii.Error):
|
249 |
raise Invalid(error_msg, params, None)
|
249 |
raise Invalid(error_msg, params, None)
|
250 |
return before_validate(hook)
|
250 |
return before_validate(antispam_hook)
|
|
|
251 |
|