On Wed, 2002-10-09 at 08:34, Geoffrey Talvola wrote:
> Ian Bicking wrote:
> > I myself never use actions, though kind of for this reason -- I have a
> > hard time arranging the logic when actions are sometimes called, and
> > sometimes not. My solution has been not to use actions at all.
> So I take it you just have "manual" action code like this:
> def writeContent(self):
> if self.request().hasField('someAction'):
> # do something
> # do whatever you're supposed to do otherwise
Yes, that's pretty much it. I often do it in awake(), and then set an
instance variable to indicate the result, and then just test that
instance variable in writeContent() and title() (since I usually change
the title too).
> > BTW, I've been using an alternate Page-like servlet structure (which I
> > haven't put in CVS or anything -- but maybe I should put it in
> > Experimental). Anyway, it makes much more significant use of
> > exceptions. I have a feeling it would simplify what you are doing,
> > since at any point you could raise a Forbidden exception. In general
> > I've found that cleaner than doing security through if statements.
> Sounds very interesting. I'd like to see the code. Checking it into
> Experimental can't hurt.
> I found that adding the EndResponse exception handling made code involving
> redirects easier to handle. Security checking is similar to a redirect, in
> that you want to stop processing and do something entirely different. So an
> exception makes good sense there too.
The other impetus was DAVKit. While I haven't actually dealt with all
the error situations yet, there's a specific way it is supposed to work,
and you can end up with situations where you need to conglomerate a
number of errors and whatnot. Exceptions seemed the best way to
standardize error information.
I've checked the code into CVS -- in WebKit/Experimental there's
NewPage.py and HTTPExceptions.py. It has a system for having
per-context subclasses of the exceptions, so you could customize error
messages and such. I'm not sure that's a good idea -- I'm thinking now
that each exception should have an associated servlet that gets
It also does not use HTTPServlet. It's always annoyed me that there's
two styles of interface, one which takes a transaction argument. So
NewPage is not thread-safe, and there's no thread-safe methods left over
from the superclass.