[Web-SIG] A trivial template API counter-proposal

Phillip J. Eby pje at telecommunity.com
Wed Feb 1 04:07:33 CET 2006

API to be provided by a "template engine":

compile_string(text), compile_stream(input_stream) - return a WSGI 
application object for the template described by the text or file-like object

write_compiled(app, output_stream) - save the compiled form of the template 
to output_stream

read_compiled(input_stream) - read a template from input_stream and return 
a WSGI application object

I believe that this is all that can reasonably be standardized by the 
Web-SIG at this time for a template API, while still treating its 
constituents fairly.  (i.e., not disadvantaging more advanced frameworks by 
being a least-common-denominator approach).

The only other thing that might be suitable for standardization would be 
any common extra 'environ' keys that might be considered desirable, like a 
"published object" key to hold the "vars" (for "controller"-style 
frameworks that postprocess a function return value) or to hold the "self" 
object (for Zope-style object publishing frameworks that apply a template 
as a view of the object addressed in the URL).

More information about the Web-SIG mailing list