[tahoe-lafs-trac-stream] [Tahoe-LAFS] #1634: TypeError due to "size" being None in pyfilesystem+dokan
Tahoe-LAFS
trac at tahoe-lafs.org
Fri Sep 19 23:18:37 UTC 2014
#1634: TypeError due to "size" being None in pyfilesystem+dokan
-------------------------+-------------------------------------------------
Reporter: zooko | Owner: Zancas
Type: defect | Status: new
Priority: major | Milestone: 1.11.0
Component: code- | Version: 1.9.0
frontend-web | Keywords: pyfilesystem dokan error webapi
Resolution: | docs mutable test-needed
Launchpad Bug: |
-------------------------+-------------------------------------------------
Comment (by warner):
So mutable filenodes (SMDF or MDMF) are allowed to return None from
`IFilesystemNode.get_size()` to indicate "I don't know yet". These mutable
filenodes cache their size when it is fetched, so the first time you
access them, you'll get None, and then if you look closely enough at them
to warrant network traffic (i.e. you call `get_current_size()`), then
you'll get real numbers from `get_size()` for as long as you hold onto
that node (or it stays in the filenode cache).
We can change the JSON return value from the WAPI independently. I'm still
slightly in favor of value=null over omit-the-key, but either way is
pretty easy.
To use value=null, the tahoe code is already correct, and what needs to
change is in pyfilesystem. In the code I've seen
(https://code.google.com/p/pyfilesystem/source/browse/trunk/fs/contrib/tahoelafs/util.py#79),
that `data.get('size', 0)` should be replaced with `data.get('size') or
0`.
To use omit-the-key, we must change tahoe's web/directory.py line 882 (in
DirectoryJSONMetadata) to fetch `childnode.get_size()` but then only add
it to `kiddata[1]['size']` if it's not None.
--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1634#comment:13>
Tahoe-LAFS <https://Tahoe-LAFS.org>
secure decentralized storage
More information about the tahoe-lafs-trac-stream
mailing list