mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-21 02:01:31 +00:00
derived function below
This commit is contained in:
parent
8f3a32a22c
commit
97872118a5
@ -203,19 +203,6 @@ def should_create_intermediate_directories(req):
|
||||
return bool(req.method in ("PUT", "POST") and
|
||||
t not in ("delete", "rename", "rename-form", "check"))
|
||||
|
||||
def humanize_failure(f):
|
||||
"""
|
||||
Create an human-oriented description of a failure along with some HTTP
|
||||
metadata.
|
||||
|
||||
:param Failure f: The failure to describe.
|
||||
|
||||
:return (bytes, int): A tuple of some prose and an HTTP code describing
|
||||
the failure.
|
||||
"""
|
||||
return humanize_exception(f.value)
|
||||
|
||||
|
||||
def humanize_exception(exc):
|
||||
"""
|
||||
Like ``humanize_failure`` but for an exception.
|
||||
@ -305,6 +292,19 @@ def humanize_exception(exc):
|
||||
return (str(exc), None)
|
||||
|
||||
|
||||
def humanize_failure(f):
|
||||
"""
|
||||
Create an human-oriented description of a failure along with some HTTP
|
||||
metadata.
|
||||
|
||||
:param Failure f: The failure to describe.
|
||||
|
||||
:return (bytes, int): A tuple of some prose and an HTTP code describing
|
||||
the failure.
|
||||
"""
|
||||
return humanize_exception(f.value)
|
||||
|
||||
|
||||
class MyExceptionHandler(appserver.DefaultExceptionHandler, object):
|
||||
def simple(self, ctx, text, code=http.BAD_REQUEST):
|
||||
req = IRequest(ctx)
|
||||
|
Loading…
x
Reference in New Issue
Block a user