On Dec 26, 2005, at 8:51 AM, Jim Fulton wrote:
Chris McDonough wrote:
FWIW, It would be nice to have some API to return large amounts
of content which doesn't live in ZODB without returning an
*actual* file object. A real world use case: In a Zope2
application, I depend on being able to return a "streamiterator"
which does decryption as it streams. I cannot write this data
temporarily to disk for business reasons (it's encrypted for a
Even on a unix-based platform on which the file is removed before
written to it?
For this project, yes, given that the project owners believe their
business model depends on "no sensitive unencrypted data ever being
written to persistent storage (even temporarily)". I've even gone as
far as to replace the logic in fieldstorage/zserver to encrypt data
that would have been written to a plain tempfile as it is inputted
from the UA as a result.
This is of course an edge case example and I don't expect others to
have the same kind of requirements. I've already needed to
monkeypatch Zope 2 to get it to do what was required of it for
*input* data, so I could of course continue to maintain code to do
this for Z3.
That said, Z2 defines a marker interface named IStreamIterator that
can be implemented by things returned to the publisher; these are
handled specially by the publisher.
> so I wrap a file pointer in
something that implements a stream iterator; it decrypts as it's
I don't know if you have this in mind still.
No, I didn't. We need to have something like this. Let's figure
it is over the next release cycle. In the mean time, an IResult-based
framework is still lurking in 3.2. You can use it if you don't
later. (Note that the adapter is now looked up for the original
result, and the
request, rather than just the original result.)
That's fine; I'm not using the Z3 publisher for this particular
project anyway. This is more of an example use case where a special
interface would be nice to retain (although the IResults thing looks
kinda complicated; a simple marker interface indicating the object is
iterable would be better I think). It of course makes sense to be
able to return "plain" files to the publisher without needing to
decorate them with any special interface, though, too.
Zope3-dev mailing list