[Zope] Testing types in TAL

Tino Wildenhain tino at wildenhain.de
Sat Nov 13 10:28:22 EST 2004


Hi,

Am Fr, den 12.11.2004 schrieb Alec Mitchell um 20:01:
...
> There must be a way to do a simple type check for a tuple without a python 
> script, no?  Right now I'm using:
> 
> tal:define="dictish nocall:obj/keys|nothing;
>             listish python:not dictish and len(obj) and (len(obj[0]) != 1)"
> 
> Which is far too kludgy, brittle, and plain incorrect for my liking.

Hm. apart from what Tres gave you (same_type) why this fear on 
python scripts? I mean, where you get the objects from - wouldn't 
it be better to provide all information you need for your ZPT
in a convenient format? If you read it directly from request/form,
you can also get the types right in the first place - with
:list, :records etc.

just 2ct ;)
Regards
Tino



More information about the Zope mailing list