mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-18 17:00:24 +00:00
some fixes
This commit is contained in:
parent
d26ce3beb0
commit
83a70bb6f3
@ -8,6 +8,7 @@ from twisted.internet import defer
|
||||
from twisted.internet.interfaces import IPushProducer
|
||||
from twisted.python.failure import Failure
|
||||
from twisted.web import http
|
||||
from twisted.web.resource import ErrorPage
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.template import (
|
||||
Element,
|
||||
@ -101,7 +102,6 @@ class DirectoryNodeHandler(ReplaceMeMixin, Resource, object):
|
||||
self.name = name
|
||||
self._operations = client.get_web_service().get_operations()
|
||||
|
||||
|
||||
def getChild(self, name, req):
|
||||
"""
|
||||
Dynamically create a child for the given request and name
|
||||
@ -122,7 +122,7 @@ class DirectoryNodeHandler(ReplaceMeMixin, Resource, object):
|
||||
Callback when self.node.get has returned
|
||||
"""
|
||||
method = req.method
|
||||
nonterminal = len(req.postpath) > 1
|
||||
nonterminal = len(req.postpath) >= 1
|
||||
t = get_arg(req, "t", "").strip() # XXX looking like MultiFormatResource..
|
||||
if isinstance(node_or_failure, Failure):
|
||||
f = node_or_failure
|
||||
@ -188,9 +188,11 @@ class DirectoryNodeHandler(ReplaceMeMixin, Resource, object):
|
||||
if not IDirectoryNode.providedBy(node):
|
||||
# we would have put a new directory here, but there was a
|
||||
# file in the way.
|
||||
raise WebError("Unable to create directory '%s': "
|
||||
"a file was in the way" % name,
|
||||
http.CONFLICT)
|
||||
return ErrorPage(
|
||||
http.CONFLICT,
|
||||
"Unable to create directory '{}': a file was in the way".format(name),
|
||||
"no details",
|
||||
)
|
||||
return make_handler_for(node, self.client, self.node, name)
|
||||
|
||||
def render_DELETE(self, req):
|
||||
|
@ -3,7 +3,10 @@ import json
|
||||
|
||||
from twisted.web import http, static
|
||||
from twisted.internet import defer
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.resource import (
|
||||
Resource,
|
||||
ErrorPage,
|
||||
)
|
||||
|
||||
from nevow import url
|
||||
|
||||
@ -150,16 +153,20 @@ class FileNodeHandler(Resource, ReplaceMeMixin, object):
|
||||
if isinstance(self.node, ProhibitedNode):
|
||||
raise FileProhibited(self.node.reason)
|
||||
if should_create_intermediate_directories(req):
|
||||
raise WebError(
|
||||
u"Cannot create directory {}, because its "
|
||||
u"parent is a file, not a directory".format(
|
||||
quote_output(name, encoding='utf-8')
|
||||
return ErrorPage(
|
||||
http.BAD_REQUEST,
|
||||
u"Cannot create directory {}, because its "
|
||||
u"parent is a file, not a directory".format(
|
||||
quote_output(name, encoding='utf-8')
|
||||
),
|
||||
"no details"
|
||||
)
|
||||
)
|
||||
raise WebError(
|
||||
return ErrorPage(
|
||||
http.BAD_REQUEST,
|
||||
u"Files have no children named {}".format(
|
||||
quote_output(name, encoding='utf-8'),
|
||||
)
|
||||
),
|
||||
"no details",
|
||||
)
|
||||
|
||||
def render_GET(self, req):
|
||||
|
Loading…
x
Reference in New Issue
Block a user