You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by "Gregory (Grisha) Trubetskoy" <gr...@apache.org> on 2002/09/25 19:41:15 UTC
None to indicate EOS [was Re: [mod_python] Filter chaining bug]
Do you mean why I chose to do it this way? I don't know, I'm guessing EOS
is a special value and so is None, and so it was the easiest thing to
indicate an EOS with None...
But if anyone has a suggestion for a more intuitive way of dealing with
EOS, now is the time to suggest it! :-)
On Wed, 25 Sep 2002, Gary Benson wrote:
> Why the "if line is None"?
>
> > The idea is that a filter needs to watch out for an EOS bucket. A read
> > operation will return None to indicate an EOS (in all other cases it
> > returns an empty string). At this point you must close() the filter.
> > (close() simply appends an EOS)
>
Re: None to indicate EOS [was Re: [mod_python] Filter chaining bug]
Posted by Gary Benson <gb...@redhat.com>.
On Thu, Sep 26, 2002 at 01:59:51PM -0400, Gregory (Grisha) Trubetskoy wrote:
>
> On Thu, 26 Sep 2002, Gary Benson wrote:
>
> > Is there any reason why the EOS isn't sent by the filterobject's
> > destructor?
>
> Yes, the filter can be destroyed before EOS. A filter context is created
> for every time the pass_brigade is called, and that can be anywhere from
> one to infinity.
>
> It might be possible to hide the EOS by looking for it inside the
> filter.read()'s implementation, setting some flag in the filter object,
> then send it out before the filter is destroyed, but it seemed like too
> much magic for me, so I figured that the compromise is to force the
> developer to deal with the EOS directly.
Fair enough :)
Gary
[ gbenson@redhat.com ][ GnuPG 85A8F78B ][ http://inauspicious.org/ ]
Re: None to indicate EOS [was Re: [mod_python] Filter chaining bug]
Posted by "Gregory (Grisha) Trubetskoy" <gr...@apache.org>.
On Thu, 26 Sep 2002, Gary Benson wrote:
> Is there any reason why the EOS isn't sent by the filterobject's
> destructor?
Yes, the filter can be destroyed before EOS. A filter context is created
for every time the pass_brigade is called, and that can be anywhere from
one to infinity.
It might be possible to hide the EOS by looking for it inside the
filter.read()'s implementation, setting some flag in the filter object,
then send it out before the filter is destroyed, but it seemed like too
much magic for me, so I figured that the compromise is to force the
developer to deal with the EOS directly.
Grisha
Re: None to indicate EOS [was Re: [mod_python] Filter chaining bug]
Posted by Gary Benson <gb...@redhat.com>.
Sorry, I didn't mean that at all, but I expressed myself really badly.
What I really should have said was that you can omit the 'if line is
None:' because you always need to close the filter and send the EOS.
Is there any reason why the EOS isn't sent by the filterobject's
destructor?
On Wed, Sep 25, 2002 at 01:41:15PM -0400, Gregory (Grisha) Trubetskoy wrote:
> Do you mean why I chose to do it this way? I don't know, I'm guessing EOS
> is a special value and so is None, and so it was the easiest thing to
> indicate an EOS with None...
>
> But if anyone has a suggestion for a more intuitive way of dealing with
> EOS, now is the time to suggest it! :-)
>
> On Wed, 25 Sep 2002, Gary Benson wrote:
>
> > Why the "if line is None"?