Re: [Zope] type checking

2008-04-15 Thread Chris Withers

Jaroslav Lukesh wrote:

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


Argggh! My eyes! They bleed!

Please dear god just use a python script or external method...

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] type checking

2008-04-14 Thread Garry Saddington
Is there any way to do data type checking in dtml-if, for example to check 
that a variable is an integer?
regards
garry
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] type checking

2008-04-14 Thread Jaroslav Lukesh

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


- Original Message - 
From: Garry Saddington [EMAIL PROTECTED]




Is there any way to do data type checking in dtml-if, for example to check
that a variable is an integer? 


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] type checking

2008-04-14 Thread Jaroslav Lukesh

Sorry, syntax error:

dtml-if _.int(variable) == variable
---^

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] type checking

2008-04-14 Thread Jonathan


- Original Message - 
From: Jaroslav Lukesh [EMAIL PROTECTED]

To: Garry Saddington [EMAIL PROTECTED]; zope@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
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )