[Zope-CMF] [dev] Document.get_size considered dumb
Florent Guillaume
fg at nuxeo.com
Wed Sep 29 08:39:13 EDT 2004
In article <cis3r9$oba$1 at sea.gmane.org> you write:
> I would like to modify the implementation of
> Products.CMFDefault.Document.get_size as follows:
>
>
> --- CMFDefault/Document.py 7 Sep 2004 08:47:54 -0000 1.69.2.2
> +++ CMFDefault/Document.py 22 Sep 2004 14:53:13 -0000
> @@ -415,6 +415,6 @@
> security.declareProtected(View, 'get_size')
> def get_size( self ):
> """ Used for FTP and apparently the ZMI now too """
> - return len(self.manage_FTPget())
> + return len(self.text)
>
> InitializeClass(Document)
>
> The current behavior tries to ensure that 'get_size' returns exactly the
> same value as the length of the decorated source text. The only
> dependent I know of for that behavir is webdav's HEAD; I have no
> problem with "breaking" that, because there is no guarantee that HEAD
> and GET will return the same values between two requests, anyway.
>
> Are there any other clients out there who care about 'get_size'? If
> noone objects, I will check it in on Friday (I may make the size cached,
> as well).
No pb with that.
As we've had requests from people about it, I'd like to confirm:
get_size() is only used for "informative human-readble" values of the
size, right ?
A use case we've had is for an objects that stores, for instance, a PDF
file, but also internal full-text versions for the indexer and other
things. The user expects to have get_size() return the size of the PDF,
but in some cases (quota accounting) we'd like to have get_size() return
the best approximation of the pickle size of the full object. So the
question is: what size is it best to have get_size() return ?
Florent
--
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 71 59 http://nuxeo.com mailto:fg at nuxeo.com
More information about the Zope-CMF
mailing list