[Zope] type checking

Jonathan dev101 at magma.ca
Mon Apr 14 18:43:38 EDT 2008


----- Original Message ----- 
From: "Jaroslav Lukesh" <lukesh at seznam.cz>
To: "Garry Saddington" <garry at schoolteachers.co.uk>; <zope at zope.org>
Sent: Monday, April 14, 2008 4:48 PM
Subject: Re: [Zope] type checking


> <dtml-try>
> <dtml-if "_.int(variable) = variable">
>    Variable is integer
> <dtml-else>
>    Variable is not integer
> </dtml-if>
> <dtml-except>
>    Variable is not number
> </dtml-try>

The 'same_type' function  may be what you are looking for:

<dtml-if "_.same_type(a,[])">
  a is a list
<dtml-elif "_.same_type(a,{})">
  a is a dict
<dtml-elif  etc>

</dtml-if>


Jonathan


More information about the Zope mailing list