durusmail: quixote-users: Quixote namespaces/callables in practice...
Quixote namespaces/callables in practice...
Re: Quixote namespaces/callables in practice...
2003-12-11
2003-12-11
2003-12-11
Quixote namespaces/callables in practice...
Stuart Hungerford
2003-12-11
Hi all,

More newbie questions.  I'm trying to get a feel for the idioms
that people use in creating real-world Quixote applications,
especially when dealing with the design choices involved in
mapping URL's to callables or namespaces.

Suppose I plan to support this URL schema at example.org:

    http://example.org/
    http://example.org/foo
    http://example.org/bar/baz
    http://example.org/bar/fiz

Assuming that Apache re-writing is re-writing these URLs to
the corresponding .../cgi-bin/ URLS for the local setup.

Suppose the Quixote driver script loads the module "example.web".
Then the _q_exports instance for "example.web" could contain
simple callables (functions or templates) to implement the
first and second URL's

     _q_exports = ["_q_index", "foo"]

For the third and fourth URL's however I could add a submodule
"example.web.bar" with callables "baz" and "fiz", OR I could
create a class with "baz", "fiz" member functions
(or _q_lookup())?

I *think* going the class route means you must use a _q_lookup()
function within "example.web" module to catch the "bar" component
of the URL and return a class instance that can then be traversed?

Which of these approaches (or other approaches) are more quixotic?
Do Quixote developers end up in practice relying on _q_lookup()
heavily for traversing deep URLs, or do they favour a more 1-1
mapping to callables?

Any advice much appreciated,





Cheers,

Stu

--
:: Stuart Hungerford (stuart.hungerford@anu.edu.au)
:: ANU Internet Futures Group



reply