[Zope-dev] [ZODB-Dev] Blobs and modes
Christian Theune
ct at gocept.com
Fri Oct 24 18:15:40 EDT 2008
On Fri, 2008-10-24 at 15:50 -0400, Benji York wrote:
> On Fri, Oct 24, 2008 at 3:28 PM, Jim Fulton <jim at zope.com> wrote:
> >
> > On Oct 24, 2008, at 3:24 PM, Benji York wrote:
> >
> >> Is there a good reason blobs don't support "b" or "t" in the mode
> >> strings passed to "open"? I'm refactoring some code that expects a
> >> file-like object to use blobs and it wants to pass "wb" as the mode
> >> (which is a sane thing to do).
> >
> > Blobs are implicitly binary. (Note the "B" in Blob.)
> >
> >> I'll add support for "b" and "t" to the blob code if no one objects.
> >
> > I object.
> >
> > BTW, this questions should have been asked o zodb-dev.
>
> [yep, copied on this message]
>
> For perpetuity:
>
> In a private discussion Jim explained that the blob .open() method
> returns things intended to be file-like, but the method itself isn't
> intended to mimic Python's "open" function, and as-such doesn't support
> the additional mode variations.
It's intended to be similar but not identical.
We originally did support 'b' and 't' but decided, as Jim pointed out,
hat we only care for binary data and thus only the binary modes.
I can't remember the reason that drove us to actually rip it out. Maybe
the archive of zodb-dev knows.
> This distinction is similar to why __init__ methods aren't described in
> (zope.interface) interfaces; how you construct an object isn't
> prescribed by the interface exposed by the object itself.
I'm not sure what you're saying. It's not the __init__ problem,
as .open() is described on the Blob class.
Christian
--
Christian Theune · ct at gocept.com
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 7 · fax +49 345 1229889 1
Zope and Plone consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20081025/2ebfc5df/attachment.bin
More information about the Zope-Dev
mailing list