[ZPT] CVS: Packages/TAL - HTMLTALParser.py:1.23 TALDefs.py:1.13 TALGenerator.py:1.24 TALInterpreter.py:1.24

Evan Simpson evan@digicool.com
Mon, 26 Mar 2001 18:21:39 -0500


From: <guido@digicool.com>
> - Support on-error.  The engine must raise TALDefs.TALESError() to
>   trigger it (other errors are not caught).  TALESError() takes up to
>   three args: msg, position, info, where msg is the message string,
>   position is a (lineno, offset) tuple, and info is the exception info
>   tuple (type, value, traceback) from sys.exc_info().  Both default to
>   tuples with all None values.  You can choose to subclass this
>   exception of course.

Can we change this so that TALInterpreter obtains TALESError from
self.engine.getTALESError?  Also, I don't think that TALES has any good way
to get access to position information.  I was thinking that TALInterpreter's
do_onError except block would look something like this (for now):

self.restoreState(state)
engine = self.engine
engine.beginScope()
engine.setLocal('error', {'message': err.msg, 'lineno': self.position[0],
'offset': self.position[1],
                                     'type': err.info[0], 'value':
err.info[1], 'traceback': err.info[2], }
self.interpret(handler)
engine.endScope()

ZPT is working, and as soon as we can make on-error useful I'd like to
release ZPT 1.0 beta.  Tomorrow, if possible.

Thanks,

Evan @ digicool