durusmail: quixote-users: A toy Nevow implementation
A toy Nevow implementation
2004-01-15
2004-01-15
2004-01-15
2004-01-15
Debug syntax errors in PTL (was: A toy Nevow implementation)
2004-01-15
Debug syntax errors in PTL (was: A toy Nevowimplementation)
2004-01-15
Debug syntax errors in PTL (was: A toy Nevowimplementation)
2004-01-16
Jason E. Sibre (2 parts)
Debug syntax errors in PTL
2004-01-22
Debug syntax errors in PTL
2004-01-18
2004-01-18
2004-01-15
Re: A toy Nevow implementation
2004-01-16
2004-01-19
Re: A toy Nevow implementation
2004-01-19
Re: A toy Nevow implementation
2004-01-19
2004-01-19
2004-01-19
2004-01-19
2004-01-19
2004-01-19
2004-01-19
2004-01-19
2004-01-20
2004-01-20
2004-01-20
2004-01-20
2004-01-21
2004-01-20
A toy Nevow implementation
Oscar Rambla
2004-01-19
On Wednesday 14 January 2004 19:11, Graham Fawcett wrote:
> Here's a little toy for your amusement. On comp.lang.python today, I
> discovered that Twisted is building a next-generation templating system,
> called Nevow (a wordplay on "Woven", their earlier system, and "nouveau").
>
> This is what Nevow template code looks like. It's valid Python, though it
> looks more like an S-expression:
>
>      document = html[
>          body[
>              form(action="")[ input(type="text", name="name") ],
>          ]
>      ]
>
> Sneaky tricks with __call__ and __getitem__ are used to pull off this feat
> of syntactic sugaring.

>
> Whether you try the code or not, it would be interesting to hear other
> people's opinions of the Nevow templating system: is it black magic to be
> shunned, the next best thing, or just YATS?

YATS?
What I see is a compact and callable python based HTML/XML representation.
And don't think I need a tutorial to remember ist syntax.

Currently, I don't use any template mechanism for html rendition, althought
have nothing against them.
But, this is a different approach.Similar to the difference between a class
and a string.
This could change in a future, and then I'd like to have a mechanism like this
integrated in the Quixote framework.

AMK wrote:

>That's pretty cute.  What are the pros and cons of this vs. PTL?
>
>* Full Nevow seems aimed at improving performance by pre-generating the
>  document, but this means you need support for callouts.
>  I'm not sure this optimization is worthwhile; is gluing together HTML
>  strings the bottleneck in any real applications?
>* No need to remember to write ending tags.  Advantage: Nevow.
>* I'll bet you could make the classes enforce validity by checking
>  the child tags (so body[input()] would raise an exception).

All these are good points.On the last, I feel really curious how the validity
checking can be done. Tag specialization?, some parsing?

About the first point:

Matt Goodall wrote:

>The context is also used to pass the tag, as defined by you in the
>document tag tree, to the renderer. The renderer can ignore the tag and
>return something new or do things like clear the tag tree and insert
>something new, lookup parts of the tree and remove/replace/repeat them etc.

I understand from this that Nowen pre-generates a tree representation.
This is a different behaviour  that could have its pros.
I wonder if both behaviours could be compatible in some way without having to
parse the result. I was not thinking in a DOM implementation. Instead, in a
light one like PyRXP. Anyway a difficult task.

Also, I'd like it were easy ( I think it is with the current code) for
programmer to provide their own specialized tags. I was thinking for example
in  tag.

From every perspective, a profitable proposal.

Oscar Rambla