[Zope] Documentation Bug
Christian Theune
ct@gocept.com
Mon, 27 Aug 2001 13:39:03 +0200
The DTML Documentation has a slight difference to the real world in it:
The description is as follows:
raise tag syntax:
<dtml-raise ExceptionName|ExceptionExpression>
</dtml-raise>
but the "expression" is confusing when you want to use
userdefined expressions. In plain python it goes following way:
>>> try:
... raise "asdf"
... except "asdf":
... print "test"
... except:
... print "notest"
...
test
>>>
So this, combined with the upper description seems to be as following:
<dtml-try>
<dtml-raise "'stringExc'"> asdf </dtml-raise>
<dtml-except "'stringExc'"> your error code here
</dtml-try>
But, the stringExc is rosen(?) as a 'real' Exception class, so
<dtml-except stringExc> would work - which is not clearly at first sight.
In the ZopeBook there is a hint on <dtml-raise type="404"> asdf </dtml-raise>
which comes up to be the most clean way.
The complete working example, most clean imo is following:
<dtml-try>
<dtml-raise type="userDefined"> asdf </dtml-raise>
<dtml-except userDefined> asdf
</dtml-except>
Any comments on that?
Btw: am i getting only responses if i turn of GPG Signaturing?
--
Christian Theune - ct@gocept.com
gocept gmbh & co.kg - schalaunische strasse 6 - 06366 koethen/anhalt
tel.+49 3496 3099112 - fax.+49 3496 3099118 mob. - 0178 48 33 981
reduce(lambda x,y:x+y,[chr(ord(x)^42) for x in 'zS^BED\nX_FOY\x0b'])