From: Geoffrey T. <gta...@na...> - 2002-10-09 13:35:00
|
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 else: # do whatever you're supposed to do otherwise > 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. - Geoff |