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

2006-01-31 Thread Phillip J. Eby
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

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

2006-02-04 Thread Guido van Rossum
[Phillip] > 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_s

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

2006-02-04 Thread Ben Bangert
On Feb 4, 2006, at 8:17 AM, Guido van Rossum wrote: > I am probably missing something, but shouldn't there also be an API to > render the template to a string or stream given some context of > variable names? I'm looking at this from a very different perspective, > namely *using* various templatin

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

2006-02-04 Thread Phillip J. Eby
At 08:17 AM 2/4/2006 -0800, Guido van Rossum wrote: >[Phillip] > > 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, o

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

2006-02-04 Thread Guido van Rossum
> >I am probably missing something, but shouldn't there also be an API to > >render the template to a string or stream given some context of > >variable names? I'm looking at this from a very different perspective, > >namely *using* various templating engines from an app that otherwise > >doesn't u

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

2006-02-05 Thread Alan Kennedy
[Guido van Rossum] > I see. But doesn't this still tie the templates API rather strongly to > a web API? What if I want to use a template engine to generate > spam^H^H^H^Hpersonalized emails? Or static HTML pages that are written > to the filesystem and then served by a classic Apache setup? Or

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

2006-02-05 Thread Phillip J. Eby
>I see. But doesn't this still tie the templates API rather strongly to >a web API? What if I want to use a template engine to generate >spam^H^H^H^Hpersonalized emails? Then set the content-type to message/rfc822. ;) > Or static HTML pages that are written >to the filesystem and then served

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

2006-02-05 Thread Phillip J. Eby
At 01:28 PM 2/5/2006 +, Alan Kennedy wrote: >I've been dismayed over the last few days trying to follow the direction >of this thread: it appears to me that something very simple has now >become very complex. On the contrary, the situation is and always has been very complex. It only appears

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

2006-02-05 Thread Guido van Rossum
[Me] > > Or static HTML pages that are written > >to the filesystem and then served by a classic Apache setup? Or source > >code (program generators are fun toys!)? [Phillip] > Use the output file's write() method as the "write" callback returned by > start_response(), or use one of the wsgiref h

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

2006-02-05 Thread Phillip J. Eby
At 10:40 AM 2/5/2006 -0800, Guido van Rossum wrote: >[Me] > > > Or static HTML pages that are written > > >to the filesystem and then served by a classic Apache setup? Or source > > >code (program generators are fun toys!)? > >[Phillip] > > Use the output file's write() method as the "write" callb

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

2006-02-05 Thread Ben Bangert
On Feb 5, 2006, at 10:40 AM, Guido van Rossum wrote: > I didn't see an output file in the proposed standard. All I saw was a > WSGI interface. The output file is a figment of your implementation. The WSGI interface indicates that the WSGI app will return its output as an iterable. While WSGI wa

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

2006-02-05 Thread Alan Kennedy
[Phillip J. Eby] > Developing WSGI was not easy, either, as I'm sure you recall.You and I > certainly argued a bit about iterators and file-like objects and such, > and it took a while before I understood all of your use cases and we > were able to resolve them in the spec. If you had given up

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

2006-02-05 Thread Ben Bangert
> # Or use Kid: > kidengine = KidTemplate(**kid_args) > content, headers = kidengine('some.template.kid', wsgi=False) > > # web > return kidengine(environ, start_response) > > Or if people don't like relying on the object to determine if there's > a keyword with wsgi = False, > > content, headers =

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

2006-02-05 Thread Ian Bicking
Phillip J. Eby wrote: >>This topic started with Buffet, the de-facto standard templating API for >>CherryPy. Buffet is just about textual templating, which is a good >>thing. That's why it's very simple, and is thus actually being used. > > > Which is precisely why we don't need to rush into bles

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

2006-02-05 Thread Ian Bicking
Phillip J. Eby wrote: >>It is my strong preference that the standard API we are attempting to >>design here does *not* tie you strongly to WSGI or the generation of >>dynamic web content. > > > That seems to be a popular position, to be sure. However, since there is > already a de facto standar

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

2006-02-05 Thread Ian Bicking
Ben Bangert wrote: >># Or use Kid: >>kidengine = KidTemplate(**kid_args) >>content, headers = kidengine('some.template.kid', wsgi=False) >> >># web >>return kidengine(environ, start_response) >> >>Or if people don't like relying on the object to determine if there's >>a keyword with wsgi = False, >

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

2006-02-05 Thread Phillip J. Eby
At 03:26 PM 2/5/2006 -0600, Ian Bicking wrote: >Even the most trivial of web applications needs templates to include >other templates, so the fact that this doesn't do anything to aid or >specify that makes the spec feel leaky. I can indicate where the >template comes from initially, but all bets

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

2006-02-05 Thread Phillip J. Eby
At 02:36 PM 2/5/2006 -0600, Ian Bicking wrote: >I think very minor fixes could improve it -- for instance, allow >template_filename as an argument instead of only template_name. Then at >least simple template filling would be handled well (e.g., enough for >Paste Script), though it is unlikely

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

2006-02-05 Thread Ian Bicking
Phillip J. Eby wrote: > At 03:26 PM 2/5/2006 -0600, Ian Bicking wrote: > >> Even the most trivial of web applications needs templates to include >> other templates, so the fact that this doesn't do anything to aid or >> specify that makes the spec feel leaky. I can indicate where the >> template

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

2006-02-05 Thread Guido van Rossum
On 2/5/06, Ian Bicking <[EMAIL PROTECTED]> wrote: > * There was an ad hoc standardization happening with TG and Buffet. > > * Other people were becoming interested. > > * Discussion was happening on the TG list, where most people on the TG > list were not particularly interested about this sort of

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

2006-02-05 Thread Michael Bayer
On Feb 5, 2006, at 5:33 PM, Phillip J. Eby wrote: > As Ben has previously pointed out, systems like Myghty are going to > ignore > your 'find_template()' because they do their own finding. So the > spec will > leak no matter what, until we get to the level of specification > called for > b

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

2006-02-05 Thread Ian Bicking
Michael Bayer wrote: > Im not totally following every detail of this discussionbut correct > me if I'm wrong, if we are just talking about a specification of how > the various components of a template engine are to look and interact > with each other, there is no reason Myghty's resolver

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

2006-02-06 Thread Michael Bayer
Ian Bicking wrote: >> I would say that >> the argument or arguments passed to find_template() need to be pretty >> open ended, since you cant predict what kinds of things might be >> meaningful to a template finder, such as in myghty's case, the resolver >> wants to know if you are asking for t

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

2006-02-06 Thread Gary Poster
On Feb 5, 2006, at 11:32 PM, Guido van Rossum wrote: > Phillip described the workflow for Django/Cheetah style templates > as follows: > >> * framework calls some Python code you wrote >> * your code returns a dictionary of values you want rendered >> * framework passes your returned values to t

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

2006-02-06 Thread Ian Bicking
Michael Bayer wrote: > Ian Bicking wrote: > >>>I would say that >>>the argument or arguments passed to find_template() need to be pretty >>>open ended, since you cant predict what kinds of things might be >>>meaningful to a template finder, such as in myghty's case, the resolver >>>wants to kno

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

2006-02-06 Thread Michael Bayer
On Feb 6, 2006, at 9:16 PM, Ian Bicking wrote: > > The inversion of control is the tricky part. In something like > Cheetah, Kid, or ZPT the template (as represented solely by the > file contents) gets control first, and then explicitly hands it off > to whatever it is "inheriting" from (t

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

2006-02-07 Thread titus
-> > Sure. I'd suggest that we might want to expand it a little to include some -> > of the fine contributions of other authors, such as Ian's "lint" middleware -> > (which sits between an app and a server and checks both for compliance) and -> > maybe even his "Python debugger in the browser" mid