[Bugs] #2303 UNSP: unnecessary checkout for getting file size
Sugar Labs Bugs
bugtracker-noreply at sugarlabs.org
Wed Sep 8 15:28:44 EDT 2010
#2303: unnecessary checkout for getting file size
------------------------------------------+---------------------------------
Reporter: sascha_silbe | Owner: alsroot
Type: defect | Status: new
Priority: Unspecified by Maintainer | Milestone: 0.90
Component: journal | Version: Git as of bugdate
Severity: Minor | Keywords:
Distribution: | Status_field: Unconfirmed
------------------------------------------+---------------------------------
Comment(by sascha_silbe):
This is what I use in the version support branch now:
{{{
filesize = self._metadata.get('filesize')
if filesize is None:
object_id = (self._metadata['tree_id'],
self._metadata['version_id'])
filesize = model.get_file_size(object_id)
lines = [
_('Kind: %s') % (self._metadata.get('mime_type') or
_('Unknown'),),
_('Date: %s') % (self._format_date(),),
_('Size: %s') % (format_size(int(filesize))),
]
}}}
Feel free to adapt for mainline.
--
Ticket URL: <http://bugs.sugarlabs.org/ticket/2303#comment:1>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system
More information about the Bugs
mailing list