[Zope] error_typ

Dieter Maurer dieter@handshake.de
Thu, 15 Feb 2001 23:26:33 +0100 (CET)


Olaf Zanger writes:
 > to do error tracking i want an
 > 
 > <dtml-elif "error_type == 'pg.error'">
 > 
 > <dtml-elif "find(error_value,'referential integrity violation')">
 > 
 > the first doesn't work since zope doesn't like the .
?? Zope will not see the '.'. It is inside a Python string.

 > the last because i don't find the an example how to use find right.
"find" returns the index, the string is found at; "-1" if
the string is not found.

Thus, you want something like "find(...) >= 0".
Be careful, however! It is not garanteed that "error_value"
will be a string (in general). It might well be
an instance, then "find" will raise a "TypeError".



Dieter