[Zope] VERY Confused!

Ben Ocean zope@thewebsons.com
Tue, 23 Oct 2001 11:43:21 -0700


Hi;
I'm new to Python and Zope, but I'm at a loss to understand WHY this 
doesn't work! I have this line in my dtml code:
<span class="top"><img src="images/top" width=<dtml-var 
"sizeCalc(1008,size)"> height=<dtml-var "sizeCalc(82,size)">></span>
*size* is a dtml method and is defined thus:
1
just the number one.
sizeCalc(x,y) is an external method and is defined thus:

import string

def sizeCalc(x,y):
  x = string.atoi(x)
  y = string.atoi(y)
  y = (x*5)
  return (x*y)

I tried the string conversions because the values are being interpreted as 
strings (already tested that). I get this error:

Error Type: TypeError
Error Value: int() can't convert non-string with explicit base

and the following:

Traceback (innermost last):
   File 
/apache/ZopeInstallation/Zope_software_home/lib/python/ZPublisher/Publish.py, 
line 223, in publish_module
   File 
/apache/ZopeInstallation/Zope_software_home/lib/python/ZPublisher/Publish.py, 
line 187, in publish
   File 
/apache/ZopeInstallation/Zope_software_home/lib/python/Zope/__init__.py, 
line 226, in zpublisher_exception_hook
     (Object: LockableItem)
   File 
/apache/ZopeInstallation/Zope_software_home/lib/python/ZPublisher/Publish.py, 
line 171, in publish
   File 
/apache/ZopeInstallation/Zope_software_home/lib/python/ZPublisher/mapply.py, 
line 160, in mapply
     (Object: template)
   File 
/apache/ZopeInstallation/Zope_software_home/lib/python/ZPublisher/Publish.py, 
line 112, in call_object
     (Object: template)
   File 
/apache/ZopeInstallation/Zope_software_home/lib/python/OFS/DTMLMethod.py, 
line 194, in __call__
     (Object: template)
   File 
/apache/ZopeInstallation/Zope_software_home/lib/python/DocumentTemplate/DT_String.py, 
line 546, in __call__
     (Object: template)
   File 
/apache/ZopeInstallation/Zope_software_home/lib/python/DocumentTemplate/DT_Util.py, 
line 231, in eval
     (Object: sizeCalc(1008,size))
     (Info: sizeCalc)
   File <string>, line 2, in f
   File 
/apache/ZopeInstallation/Zope_software_home/lib/python/Products/ExternalMethod/ExternalMethod.py, 
line 274, in __call__
     (Object: sizeCalc)
     (Info: ((1008, <DTMLMethod instance at 88917d0>), {}, None))
   File /apache/ZopeInstallation/Zope_software_home/Extensions/sizeCalc.py, 
line 4, in sizeCalc
   File 
/apache/ZopeInstallation/Zope_software_home/lib/python2.1/string.py, line 
214, in atoi
TypeError: (see above)

What am I doing wrong?
Frustrated,
BenO