durusmail: quixote-users: Quixote best practices?
Quixote best practices?
2003-11-07
2003-11-07
2003-11-07
2003-11-11
2003-11-11
2003-11-11
2003-11-12
2003-11-11
2003-11-12
2003-11-13
2003-11-07
Quixote best practices -> HTML menu
2003-11-07
2003-11-07
2003-11-07
Quixote best practices?
A.M. Kuchling
2003-11-12
On Fri, Nov 07, 2003 at 08:40:09AM -0600, Skip Montanaro wrote:
>     * Package nesting - Do people tend to nest packages or use other objects
>       (classes, for example) to effect nesting?  Or do you normally keep
>       your URL space pretty flat so nesting is not an issue?

What Neil said.  Usually modules and packages are used for fixed things --
/catalog, /user, etc.  The module then has a _q_getname() that looks up the
relevant information and returns a WhateverUI instance that can be traversed
further.

>     * Keeping old URLs - Do you just use mod_rewrite or is there a way
>       within Quixote to map (for example),
>         http:/www.musi-cal.com/edit.html
>       onto Quixote's way of doing things?

You could implement this with a _q_getname(), since 'edit.html' isn't a
legal Python identifier:

def _q_getname (request, component):
    if component == 'edit.html':
         return request.response.redirect('/edit')

But my inclination would be to use a RedirectPermanent or a RewriteRule in
the server configuration, because that way the redirection is handled in
fast C code, not in slower Python code.

The exception might be if the redirect was really complicated with messy
regex patterns; it might be easier to write and debug in Python. (On a
similar note for e-mail: I'm finding it easier to write filtering rules for
Exim using Python than to struggle with remembering Exim's filtering
language.  I only do this about once a month, enough time to forget
everything about the syntax, so doing it in Python means it's much more
familiar.)

>     * result caching - Quixote doesn't seem to do any of this.  Mason makes
>       caching essentially trivial to handle on a component-by-component
>       basis, so you don't need to get your hands dirty setting up caching
>       proxy servers and can control caching at a fine-grained level,
>       addressing hot spots as they pop up.

Interesting; see http://www.masonhq.com/docs/manual/Devel.html#data_caching .

For Quixote the problem reduces to "how do you cache the output of Python
callables?" I don't know of a solution as fancy as Mason's, though you could
easily do a little memoization wrapper around a function.

>     * Session management - Mason uses the perl Apache::Session module.  We
>       store our session info in our MySQL database.  Is there any support
>       for this?

See http://www.mems-exchange.org/software/quixote/doc/session-mgmt.html for
an explanation of session management.  I haven't seen any code specifically
for a MySQL database.  (Probably wouldn't be a bad idea to add it, since
MySQL is quite widely used.)

--amk

reply