[Web-SIG] My original template API proposal

James Y Knight foom at fuhm.net
Mon Feb 6 00:37:01 CET 2006

On Feb 5, 2006, at 6:17 PM, Ian Bicking wrote:
>           ``set_header_callback`` is a function that can be called  
> like
>           ``set_header_callback(header_name, header_value)``.
>           Arguments can only be strings (not unicode) [encode unicode
>           with ASCII?].  The header named ``'Status'`` can be used to
>           set the status.  Even if this template is rendered in a web
>           environment, frameworks may not provide this callback if  
> they
>           do not expect or wish the template to effect the headers.
>           This function returns an iterator which produces strings or
>           unicode strings.  (It should produce one or the other, not
>           both.)  Unicode is preferred.

Now that you're re-specifying something similar to WSGI, you need to  
consider issues like what should happen if you call the  
set_header_callback after having yielded one string out of the  
iterator. Is that an error, or is it silently ignored, or can the  
container decide? Also, is the caller required to send the strings  
returned by the iterator to the browser immediately, or can it buffer  
it all up to send when the template iterator finishes? Or doesn't it  


More information about the Web-SIG mailing list