durusmail: quixote-users: Quixote 2 Docs
Quixote 2 Docs
2005-07-13
2005-07-13
2005-07-14
2005-07-14
Quixote 2 Docs
mso@oz.net
2005-07-14
Brandon King said:
>     I guess what I meant was that I found documentation for quixote 1,
> and only documentation that says some of the existing documentation is
> only partially compatible with quixote 2. So, I guess my new refined
> question is "How do I tell what documentation is for quixote 1 vs
> quixote 2?"

In Q2, your application is a Directory subclass
(quixote.directory.Directory), and all subdirectories are also Directory
subclasses.  The leaf object ("callable") is a method of its Directory.
Q1 does not have a Directory class, and allows a directory to be any
object including modules.

(Strictly speaking, a directory has to be something with a compliant
.._q_traverse method, but in most cases a Directory subclass is the easiest
way.)

In Q2, the "callable" takes no arguments except 'self'.  In Q1, it takes a
'request' argument.  To get the request in Q2, do:
    import quixote
    req = quixote.get_request()

Likewise, quixote.get_session(), quixote.get_user().  In Q1 you did
request.session and request.session.user.  The current implementation
allows this but it's deprecated.

Many customizations that formerly required subclassing the Publisher can
now be done by overriding ._q_traverse.  This includes redirecting to a
login form, checking user permissions, initializing extra request
attributes or session attributes, taking the remaining "subdirectories" in
the URL and calculating a result (e.g., "/blog/2005/07/13/"), etc.

If you are using ._q_index() for the main page of a directory, you must
explicitly put '' in the ._q_exports list.

SessionPublisher has been merged into Publisher, and the session storage
code has been rewritten.  The Session object itself is unchanged.

The way to launch an application and tie it to a particular Directory and
SessionManager has changed; see the demos.

The way to override exception handlers in the Publisher has changed.

You must explicitly import several things that used to be automatic.  Just
import things as normal and you'll be fine.

Those are the ones off the top of my head.  docs/upgrading.txt would be
useful reading, to see what telltale signs characterize various versions.

By the way, Quixote doesn't come with persistent session stores.  If
you're using a multi-process server like SCGI or you need sessions to last
through a server restart, see the session2 package at
http://quixote.idyll.org/ .

--
-- Mike Orr 

reply