[ZPT] Page Template Preconditions?

Steve Drees drees@rangebroadband.com
Fri, 9 Aug 2002 16:00:08 -0500


> Jeffrey P Shell wrote:
> > So then I tried doing a <..tal:define="dummy
> > python:here.checkSession(...)">, but in any combination I tried
> the redirect
> > never happened - raising one just brought up TALESError, and I think a
> > 'RESPONSE.redirect(...)' call just got swallowed.
>
> These should both work :-(

I've used this idiom frequently. So I suspect it's something special about
Jeffrey's situation.


>
> > So what I'm wondering is if there's been any thoughts to doing
> some sort of
> > 'precondition' script/expression, or adding in some event hooks to Page
> > Templates?  ASP.NET (and possibly earlier versions) has a Page_Load(...)
> > event handler that developers can write.
>
> I have developed a pattern for pages that require a lot of prep work
> (especially form/wizard participants) that involves directing all
> requests to a Script.  The Script does the prep, then usually ends with
> a 'return container['scriptname.pt'](somedata=somedata)'.

This is my most frequently used pattern, and one of the main reasons I
prefer ZPT/Python Scripts over DTML cruftiness.