durusmail: quixote-users: Quixote with ZPT?
Quixote with ZPT?
2002-11-05
2002-11-06
2002-11-06
This is why Quixote appeals to me (was: Quixote with ZPT?)
2002-11-06
This is why Quixote appeals to me (was: Quixote with ZPT?)
This is why Quixote appeals to me (was: Quixote with ZPT?)
2002-11-06
This is why Quixote appeals to me
2002-11-06
2002-11-11
Quixote with ZPT?
Juan David Ibáñez Palomar
2002-11-06
Bud P. Bruegger wrote:

>I've always thought it was a nice idea of separating design and development.
>But since I've worked on project that used designers without a clean
>separation, I know it's a life saver!
>
>There are other approaches to separation besides ZTP.  One--and I believe the
>first ever--is Enhydra's XMLC (http://xmlc.enhydra.org/index.html).  It is
>written in Java (and people use it from Jython it seems).  The concept is to
>use id attributes in the html/xml document from the designer and use XMLC to
>compile it to a (java) class that builds a DOM of the document with special
>accessor methods where elements had id attributes.  Designer tools seem to
>leave the id attributes alone (as they leave the attribute language used in ZTP
>alone).  Developers use DOM methods to manipulate the DOM, substituting element
>contents, etc.
>
>
>

If my memory doesn't fails, XMLC inspired Lalo Martins to develop
Hiperdom, which is the ancestor of ZPT.

Personally I'm quite deceived with ZPT.


>It seems that also Twisted uses a similar approach with its DOM Templates
>(http://www.twistedmatrix.com/documents/howto/domtemplate).  That is in Python
>but I don't know how easy it is to use outside Twisted (????).
>
>It may be easy to implement a poor man's XMLC in Python by simply parsing a
>document to a DOM and pickling it for later use.  This gives you standard DOM
>methods for modifying the DOM before writing it out as response.  Some optional
>add-ons would be to use tidy before building the DOM
>(http://www.lemburg.com/files/python/mxTidy.html) as does XMLC.  Also you could
>write a simple wrapper on top of the DOM to make the most used modification
>tasks easier and more Pythonic.  Finally, you could have a simple run-time
>method to chose one of the pickled DOMs based on preferences (language, style,
>etc.).
>
>
>

Interesting, you describe some of the things I've aleady implemented
in XPY :-)

As I am unhappy with the available tools in Python I decided to
write yet another one, whose name is XPY. It is still in an early
stage of development, but I already use it for my web site (see
http://www.j-david.net).

XPY is mostly inspired in XSLT, the main difference is that the
transformation language is Python. It stands for "XPath PYthon".

The idea is, from an XHTML file (or in general, an XML file) a DOM
tree is built with an extended higher level API. To this tree you
apply a rule, which is a Python function. This rule can use xpath
expressions to match other nodes in the tree and apply other rules,
the tree is transformed using the standard DOM API, or better, the
higher level one provided by XPY.


>A shortcoming of this and all DOM-based methods (and I believe also ZTP?) is in
>the granularity;  I don't believe it is the page (document) that should be the
>object of design but rather a page fragment (DOM fragment) that I normally call
>widget.  These are parts like headers, footers, titles, nav bars, form
>elements, etc. that are typically reused on multiple pages.  I haven't yet
>looked into how easy it would be to pickle DOM fragments instead of a complete
>DOM.
>
>I have put quite some thought into these matters, wanting to implement database
>widgets for quixote that have a data binding and a pluggable rendering with
>clean separation of design.  But haven't had the time to implement anything
>yet.
>
>
>

Maybe you want to look at XPY, get it from the CVS of the lleu
project in SourceForge:

http://sf.net/projects/lleu

I'm very interested on finding people that helps me to develop it,
because I don't have too much time.

By the way, XPY has nothing to do with Zope, it is a Python module
and uses distutils.


Best regards,

--
J. David Ibanez, http://www.j-david.net
Software Engineer / Ingenieur Logiciel / Ingeniero de Software



reply