[Sugar-devel] [PATCH sugar-datastore] Ensure we return valid internal / calculated properties

Sascha Silbe silbe at activitycentral.com
Tue Jan 17 15:18:20 EST 2012


Excerpts from Simon Schampijer's message of 2012-01-10 14:19:59 +0100:

> It would be good to add here information what the patch does, that it 
> adds the uid and filesize to the metadata but does not write it to disk etc.

How about this additional paragraph:

We now determine and fill in the 'filesize' and 'uid' properties in find()
and get_properties(), instead of relying on the on-disk copy in
.../metadata/{filesize,uid}.


[_fill_internal_props()]
> > +            file_path = self._file_store.get_file_path(uid)
> > +            if os.path.exists(file_path):
> > +                stat = os.stat(file_path)
> > +                metadata['filesize'] = str(stat.st_size)
> > +            else:
> > +                metadata['filesize'] = '0'
> 
> Why do you make the filesize a string here? In all the other cases in 
> the code it is an int e.g.:

Because in the other cases we store it on disk afterwards, converting it
to a string on the way. (Binary) strings are the only type supported by
sugar-datastore >= 0.84, everything else gets converted somewhere.

Sascha

-- 
http://sascha.silbe.org/
http://www.infra-silbe.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120117/559420e0/attachment.pgp>


More information about the Sugar-devel mailing list