Alberto Valverde wrote:
A place in environ where controllers could dump their genshi
unserialized stream so upper layers have a chance to filter it and
finally serialize it sounds like a possible way to implement it...
I *believe* Elvelind is interested is interested in this part of TG...
(am I right?)
The way I'm doing this in HTTPEncode is that the app_iter that is
returned has an attribute, that would probably be something like
app_iter.decoded = ('genshi.Markup', stream)
Then middleware can see that and get the unserialized data. The
app_iter itself serializes lazily. The lazy serialization should
actually only be done when it knows someone higher up might be looking
for unserialized data, which it would tell by a marker in the environ --
the flaw with lazy serialization being that you can't set a Content-Length.
Anyway, this degrades well for middleware that actually wants to look at
the text response. If you use the environ for the response, there's a
good chance that information could get lost, like in a stack like:
GenshiMarkupTransform
ProfileInfoAdder
Application
If the Application produces environ['genshi.output_markup'], and
ProfileInfoAdder (something like egg:Paste#profile) just works on text,
adding profiling information, GenshiMarkupTransform will end up throwing
away ProfileInfoAdder's information if it ignores the app_iter and reads
the output from the environ. By attaching the data to the app_iter
directly this case is avoided.
--
Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---