durusmail: quixote-users: Re: Do you use ptl, form library?
Do you use ptl, form library?
2004-06-10
2004-06-10
2004-06-14
2004-06-14
2004-06-14
2004-06-14
Re: Do you use ptl, form library?
2004-06-14
Quixote & Cheetah (Re: Do you use ptl, form library?)
2004-07-07
Re: Do you use ptl, form library?
Graham Fawcett
2004-06-14
Thomas Guettler wrote:
> Hi!
>
> I switched from Zope to quixote and ZODB because it is
> easier to understand.
>
> Up to now, I don't use ptl and the form library.
>
> Are there other people doing it this way
> (using _q_exports and _q_index()  in
> python code) ?


I use PTL, though not the forms library.

In PTL, I use a 'tags' module that allows expressions like:

     ...
     table_open(border=1, cellpadding=4)
     tr(
         th('Heading'),
         td('Data'),
         klass='my_data_row')
     table_close()
     para(link('doc/', 'Help'))
     ...

as well as a Page construct, that lets me centralize common stuff like
page headers and footers:

     def _q_index [html] (req):
         page = Page('Title of my page')
         page.open_head(req)
         script('window.onload = function() {alert("Welcome!");}')
         page.open_body(req)
         para(link('/', 'Back to the Home Page'))
         page.close(req)

Page renders a basic page with a simple header and footer; I can
subclass Page to get pages which require a different structure.

I like having these available, but also love that I am not forced to use
them in any Quixote function that needs a different approach.


On another note, I had a team of students working on a Web project
recently; they had a pretty good Java background, but no Python (and
certainly no PTL!). I wrote a short module to use Cheetah templates
along with "scripts" (short files containing a single request handler)
within Quixote, so that they had something conceptually similar to JSP
and Servlets. That seemed to work out very well for them, and I think
they were more comfortable using this than they would have been with PTL.

Above all, I like that Quixote leaves me with the power to choose, and
that my choices are limited only by Python itself.



-- Graham



reply