[ZPT] Equivalent for dtml-raise?

Evan Simpson evan@digicool.com
Tue, 10 Jul 2001 11:32:04 -0400


Brent Hendricks wrote:

> In building a custom loginForm for the LoginManager product, I've
> discovered that the form must raise the 'LoginRequired' exception in
> order to be displayed.  In DTML, it is done with <dtml-raise>.  I
> tried <div tal:define="result python:raise('LoginRequired')"> but I

There's no direct way to do this from a Template.  You need a Script 
containing:

raise 'LoginRequired'

...which you can call from the Template using:

tal:define="foo here/raiseLogin"

You could also use DTML to raise the exception, if you wanted.  It's too 
bad that LoginManager doesn't provide a method that you could call to 
raise the exception.

Cheers,

Evan @ digicool