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-12
 >Correct.  Quixote will check if example.web has a 'bar' attribute; if it
 >does,  the attribute's value will continue to be traversed.  If there's no
 >such attribute, Quixote will then try to import example/web/bar.{py,ptl}.
 >If that module can't be imported, Quixote will call
 >example.web._q_lookup(request, 'bar').

     That's a really useful algorithmic summary of what goes on during
     Quixote URL navigation.  If there's ever a Quixote FAQ I'd vote for
     a similar pseudocode type explanation to be in there.

 > [...]
 >> 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?
 >
 >Not necessarily.  You could write something like this:
 >
 >class BarUI: ...
 >bar = BarUI()
 >
 >'bar' would then be a module-level variable that's initialized at import
 >time.  However, it's not very useful to do this, because you could just
 >make the methods of BarUI module-level functions instead.

     I think that's a useful Quixote pattern or idiom there if you're
     needing to use classes rather than modules for managing your
     abstractions.  It makes me realize just how flexible the Quixote
     object publishing process is.
Cheers,

Stu

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



reply