mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-07 20:00:20 +00:00
Allow URIs passed in the initial JSON for t=mkdir-with-children, t=mkdir-immutable to be Unicode. Also pass the name of each child into nodemaker.create_from_cap for error reporting.
This commit is contained in:
parent
c8607be10e
commit
fa0fd66e17
@ -11,7 +11,8 @@ from allmydata.interfaces import ExistingChildError, NoSuchChildError, \
|
|||||||
EmptyPathnameComponentError, MustBeDeepImmutableError, \
|
EmptyPathnameComponentError, MustBeDeepImmutableError, \
|
||||||
MustBeReadonlyError, MustNotBeUnknownRWError
|
MustBeReadonlyError, MustNotBeUnknownRWError
|
||||||
from allmydata.mutable.common import UnrecoverableFileError
|
from allmydata.mutable.common import UnrecoverableFileError
|
||||||
from allmydata.util import abbreviate # TODO: consolidate
|
from allmydata.util import abbreviate
|
||||||
|
from allmydata.util.stringutils import to_str
|
||||||
|
|
||||||
class IOpHandleTable(Interface):
|
class IOpHandleTable(Interface):
|
||||||
pass
|
pass
|
||||||
@ -64,17 +65,14 @@ def convert_children_json(nodemaker, children_json):
|
|||||||
children = {}
|
children = {}
|
||||||
if children_json:
|
if children_json:
|
||||||
data = simplejson.loads(children_json)
|
data = simplejson.loads(children_json)
|
||||||
for (name, (ctype, propdict)) in data.iteritems():
|
for (namex, (ctype, propdict)) in data.iteritems():
|
||||||
name = unicode(name)
|
namex = unicode(namex)
|
||||||
writecap = propdict.get("rw_uri")
|
writecap = to_str(propdict.get("rw_uri"))
|
||||||
if writecap is not None:
|
readcap = to_str(propdict.get("ro_uri"))
|
||||||
writecap = str(writecap)
|
|
||||||
readcap = propdict.get("ro_uri")
|
|
||||||
if readcap is not None:
|
|
||||||
readcap = str(readcap)
|
|
||||||
metadata = propdict.get("metadata", {})
|
metadata = propdict.get("metadata", {})
|
||||||
childnode = nodemaker.create_from_cap(writecap, readcap)
|
# name= argument is just for error reporting
|
||||||
children[name] = (childnode, metadata)
|
childnode = nodemaker.create_from_cap(writecap, readcap, name=namex)
|
||||||
|
children[namex] = (childnode, metadata)
|
||||||
return children
|
return children
|
||||||
|
|
||||||
def abbreviate_time(data):
|
def abbreviate_time(data):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user