[Zope] wrong value for integer variable?

Thomas Weiner weiner@tu-harburg.de
Thu, 29 Jul 1999 11:13:09 +0200


Tony McDonald schrieb:
> 
> At 4:27 pm -0400 28/7/99, Michel Pelletier wrote:
> > > -----Original Message-----
> >> From: Donald Holten [mailto:donner@biophysics.lanl.gov]
> >> Sent: Wednesday, July 28, 1999 4:14 PM
> >> To: michel@digicool.com
> >> Cc: zope@zope.org
> >> Subject: RE: [Zope] wrong value for integer variable?
> >>
> >>
> >>      Something very interesting...  I changed the code as
> >> you said, and, as I
> >> sort of figured, it didn't work (only because I saw that
> >> python has no way to
> >> convert strings to ints).
> >
> >Sure it does, int().  In DTML, you can access this via the _ namespace,
> >ie.
> >
> ><dtml-if "_.int('1') == 1">
> >  Hey, it works!
> ></dtml-if>
> >
> >-Michel
> 
> There's also atoi, which uses an arbitrary base...I tried to use it
> so; and got an attribute error
> <dtml-var "_.atoi('178')">
> and
> <dtml-var "_.atoi('178', 16)">
> tone

I think atoi comes from the string module.
Maybe  <dtml-var "_.string.atoi('178')"> works.

> 
> ------
> Dr Tony McDonald,  FMCC, Networked Learning Environments Project
> http://nle.ncl.ac.uk/
> The Medical School, Newcastle University Tel: +44 191 222 5888
> Fingerprint: 3450 876D FA41 B926 D3DD  F8C3 F2D0 C3B9 8B38 18A2
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 
> (To receive general Zope announcements, see:
> http://www.zope.org/mailman/listinfo/zope-announce
> 
> For developer-specific issues, zope-dev@zope.org -
> http://www.zope.org/mailman/listinfo/zope-dev )

-- 
fon: ++49 (0)40 42878 3781
fax: ++49 (0)40 42878 2728