def test_GET_FILEURL_named(self):
base = "/file/%s" % urllib.quote(self._bar_txt_uri)
+ base2 = "/named/%s" % urllib.quote(self._bar_txt_uri)
d = self.GET(base + "/@@name=/blah.txt")
d.addCallback(self.failUnlessIsBarDotTxt)
d.addCallback(lambda res: self.GET(base + "/blah.txt"))
d.addCallback(self.failUnlessIsBarDotTxt)
d.addCallback(lambda res: self.GET(base + "/ignore/lots/blah.txt"))
d.addCallback(self.failUnlessIsBarDotTxt)
+ d.addCallback(lambda res: self.GET(base2 + "/@@name=/blah.txt"))
+ d.addCallback(self.failUnlessIsBarDotTxt)
return d
def test_PUT_FILEURL_named_bad(self):
if isinstance(node_or_failure, Failure):
f = node_or_failure
f.trap(KeyError)
- # create a placeholder
+ # create a placeholder which will see POST t=upload
return PlaceHolderNodeHandler(self.node, name)
else:
node = node_or_failure
req = IRequest(ctx)
t = get_arg(req, "t", "").strip()
replace = boolean_of_arg(get_arg(req, "replace", "true"))
- if t == "mkdir":
- d = self.parentnode.create_empty_directory(self.name, replace)
- d.addCallback(lambda node: node.get_uri())
- d.addCallback(text_plain, ctx)
- elif t == "upload":
+ if t == "upload":
# like PUT, but get the file data from an HTML form's input field.
# We could get here from POST /uri/mutablefilecap?t=upload,
# or POST /uri/path/file?t=upload, or
# behavior, we just ignore any name= argument
d = self.replace_me_with_a_formpost(ctx, replace)
else:
+ # t=mkdir is handled in DirectoryNodeHandler._POST_mkdir, so
+ # there are no other t= values left to be handled by the
+ # placeholder.
raise WebError("POST to a file: bad t=%s" % t)
when_done = get_arg(req, "when_done", None)