Re: I miss size() (and some latest frustration)

Barry Warsaw <[email protected]> Fri, 25 Mar 2011 16:10:03 -0400
Newsgroups gmane.comp.python.mime.devel
Organization Damn Crazy Followers of the Horn
Message-ID <[email protected]>
On Mar 24, 2011, at 03:54 PM, Glenn Linderman wrote:

>When created by a parser, it could have the notion of size-seen-so-far, or
>bytes-fed.  Once the whole message has been processed, the size of the
>message would be known, as well as of each piece.

It makes sense to record this in the Message objects, but I'd want to be very
careful about what that attribute is called.  Using just 'size' could be
misleading, either because parsing has not completed, or because they might
think that it's an exact count of the serialized size.  Something like
'parsed_byte_count' might be okay though.

>Incomplete messages, such as those from IMAP servers for which only partial
>requests have been made for pieces, could only get the concept of "total
>size" from the server, if it provides it.  Since POP servers do, I think IMAP
>would also, but I'm not an IMAP expert.

In a case like that, an attribute such as 'server_reported_size' or some such
would be okay.

>For message parsing, it seems like allowing registered callbacks for various
>pieces would be handy... "Call me when you parse this type of a header" (or
>body part, etc.).

I think David's design documents to allow for extensions and callbacks based
on the content-types of things seen.

Cheers,
-Barry
signature.asc (application/pgp-signature, 836 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCAAGBQJNjPabAAoJEBJutWOnSwa/GWsP/2IN4q5o1M8cJ2gn9X7MhR7l
x0r71++96sivEp2hg8x6jdXkfwVhRhgspFbPeF5IXOmPeBOECYJSss04hpezHLSu
i/pPQrVydORSDQzTRtgS7SIj1kzH7PdYhip2Iii6yE0OHxjtqTTm5IScxX6Fu5TB
vCKBcbdpgv2ez9vxY9xIpaj9Sqi8NExACAsWTxBc8cxLKMknmmTf/e3JgdiaXkF7
DXzUvVF1iqhal4Ye9KDjDVwzoDIgl7/igWBDExIgjp/p/UmqYYBE+QEApBoqcSCG
k+eiNjiBuyg+WJdUGKduy2SxfKxw0D7LFOU8RizlUZd5R0rdLIjvwXxpqu7R6CKO
Myw/K13+goFSlv3H46WwBXyJo0p5H00FZE+GIyOr4DfAwmwUZTRdAc0IbAEBsfLz
22LIcnaZlCYkUaz6tdobL/YjxZnzq1n0m+ESTEZYIc6RFnqFYY2aWHDMTZlnIv3D
2ZZ+vPWI7b3IRUa99W79BBegZMn6FcQiBMQc2+yfDacb0Ei+zI0SzrK+DxoHfRRa
Ree0lU7K0GqGKtK8PFO8nB4D+jHY+ROYRb1JMzTtO48ekQOwGmiEIW/lf140Fl5T
bLj53olZjEuIp4KaRTnfZVbF8rlyQa3jSIg9OJadXIHu+haFzfMc3XfEKMW/GIuu
49300Ci3C9nEu2t2mHoB
=vWqg
-----END PGP SIGNATURE-----