Here are the examples of the python api twisted.web.http.NOT_IMPLEMENTED taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
3
Example 1
def __init__(self, url, message=''):
super(NotImplemented, self).__init__(
http.NOT_IMPLEMENTED,
'Not Implemented: {url}\n{message}'.format(
url=url, message=message
),
{'content-type': 'text/plain'}
)
3
Example 2
Project: tahoe-lafs Source File: filenode.py
def render_PUT(self, ctx):
req = IRequest(ctx)
t = get_arg(req, "t", "").strip()
replace = parse_replace_arg(get_arg(req, "replace", "true"))
assert self.parentnode and self.name
if req.getHeader("content-range"):
raise WebError("Content-Range in PUT not yet supported",
http.NOT_IMPLEMENTED)
if not t:
return self.replace_me_with_a_child(req, self.client, replace)
if t == "uri":
return self.replace_me_with_a_childcap(req, self.client, replace)
raise WebError("PUT to a file: bad t=%s" % t)
0
Example 3
Project: mamba-framework Source File: test_response.py
def test_not_implemented_code_is_501(self):
result = response.NotImplemented('/test')
self.assertEqual(result.code, http.NOT_IMPLEMENTED)
0
Example 4
Project: tahoe-lafs Source File: common.py
def renderHTTP_exception(self, ctx, f):
try:
text, code = humanize_failure(f)
except:
log.msg("exception in humanize_failure")
log.msg("argument was %s" % (f,))
log.err()
text, code = str(f), None
if code is not None:
return self.simple(ctx, text, code)
if f.check(server.UnsupportedMethod):
# twisted.web.server.Request.render() has support for transforming
# this into an appropriate 501 NOT_IMPLEMENTED or 405 NOT_ALLOWED
# return code, but nevow does not.
req = IRequest(ctx)
method = req.method
return self.simple(ctx,
"I don't know how to treat a %s request." % method,
http.NOT_IMPLEMENTED)
req = IRequest(ctx)
accept = req.getHeader("accept")
if not accept:
accept = "*/*"
if "*/*" in accept or "text/*" in accept or "text/html" in accept:
super = appserver.DefaultExceptionHandler
return super.renderHTTP_exception(self, ctx, f)
# use plain text
traceback = f.getTraceback()
return self.simple(ctx, traceback, http.INTERNAL_SERVER_ERROR)