Changeset d71adaf in trunk
- Timestamp:
- 2009-07-04T03:43:01Z (16 years ago)
- Branches:
- master
- Children:
- 5501983
- Parents:
- 34213cd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/allmydata/dirnode.py ¶
r34213cd rd71adaf 171 171 # URI to create our own. 172 172 self._node = self.filenode_class(self._client) 173 empty_contents = self._pack_contents( {})173 empty_contents = self._pack_contents(CachingDict()) 174 174 d = self._node.create(empty_contents, keypair_generator, keysize=keysize) 175 175 d.addCallback(self._filenode_created) … … 225 225 # an empty directory is serialized as an empty string 226 226 if data == "": 227 return {}227 return CachingDict() 228 228 writeable = not self.is_readonly() 229 children = {}229 children = CachingDict() 230 230 position = 0 231 231 while position < len(data): … … 244 244 metadata = simplejson.loads(metadata_s) 245 245 assert isinstance(metadata, dict) 246 children [name] = (child, metadata)246 children.set_both_items(name, entry, (child, metadata)) 247 247 return children 248 248 249 249 def _pack_contents(self, children): 250 250 # expects children in the same format as _unpack_contents 251 assert isinstance(children, dict)251 assert isinstance(children, CachingDict) 252 252 entries = [] 253 253 for name in sorted(children.keys()): 254 child, metadata = children[name] 255 assert isinstance(name, unicode) 256 assert IFilesystemNode.providedBy(child), (name,child) 257 assert isinstance(metadata, dict) 258 rwcap = child.get_uri() # might be RO if the child is not writeable 259 if rwcap is None: 260 rwcap = "" 261 assert isinstance(rwcap, str), rwcap 262 rocap = child.get_readonly_uri() 263 if rocap is None: 264 rocap = "" 265 assert isinstance(rocap, str), rocap 266 entry = "".join([netstring(name.encode("utf-8")), 254 entry, metadata = children.get_both_items(name) 255 if entry == None: 256 child, metadata = metadata 257 assert isinstance(name, unicode) 258 assert IFilesystemNode.providedBy(child), (name,child) 259 assert isinstance(metadata, dict) 260 rwcap = child.get_uri() # might be RO if the child is not writeable 261 if rwcap is None: 262 rwcap = "" 263 assert isinstance(rwcap, str), rwcap 264 rocap = child.get_readonly_uri() 265 if rocap is None: 266 rocap = "" 267 assert isinstance(rocap, str), rocap 268 entry = "".join([netstring(name.encode("utf-8")), 267 269 netstring(rocap), 268 270 netstring(self._encrypt_rwcap(rwcap)),
Note: See TracChangeset
for help on using the changeset viewer.