durusmail: quixote-users: Starting out with my own Quixote test apps
Starting out with my own Quixote test apps
2004-08-09
2004-08-10
Starting out with my own Quixote test apps
David M. Cooke
2004-08-10
On Mon, Aug 09, 2004 at 08:41:07AM -0700, Tobiah wrote:
> Hello,
>
> I'm just done checking out the demo, and starting
> plugging together a small test app.  The whole
> idea of Quixote is quite new to me, and so I am a bit
> confused.
>
> The answer to this question may help a little bit.
>
> Is PTL only available in files that get called as
> an after component to the base cgi file?  For instance,
> if 'foo.cgi' gets called with '/foo.cgi/component',
> is the magic bit that probes the python namespace for
> that item the thing that parses the PTL and changes
> it into python?

You can have a _q_index() function that handles the top-level case
(i.e., /foo.cgi/).

> Let me take a stab at describing what I see so far,
> so that I might be corrected.
>
> I'm guessing that when Apache parses a URL, and finds
> an executable in the middle, where a directory should
> be, it just passes the remainder of the URL in the
> environment, or as an argument.  So, really, I'm
> just running the same cgi script every time.

Yes, exactly. For CGI, the remaining URL components are passed as part
of the environment.

> It must be the Publisher object that imports the proper callable in
> response to the argument, preprocessing any PTL that it finds into
> maybe a temp file before it gets run.

Almost; .ptl files are really sort-of python modules. After enable_ptl()
is called, they can be imported just like Python modules, and used the
same way. The PTL template functions become real Python functions.

The Quixote documentation explains this pretty well: see programming.txt and
PTL.txt in the doc/ directory.

This is also the reason your .cgi won't be a PTL template file;
enable_ptl() would not have been called before it was imported.

--
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm@physics.mcmaster.ca

reply