Hi, all. Zope 2.2.2, Python 1.5.2, Linux 2.4.1 Got an python module (/opt/Zope/Extensions/selfInfo.py) which returns a dictionary. Got a Zope external method "Get_Self_Info" w/ appropriate function/filename. Now... when calling from either a DTML Document or DTML Method, something's going screwy. ### CALL 1 ### <dtml-var Get_Self_Info> returns {'cpuLoading': 16.4179104478} Beautiful, no? ### CALL 2 ### <dtml-var "Get_Self_Info['cpuLoading']"> barfs, returns Error Type: AttributeError Error Value: __getitem__ ... File /opt/Zope/lib/python/DocumentTemplate/DT_Util.py, line 337, in eval (Object: Get_Self_Info['cpuLoading']) (Info: Get_Self_Info) File <string>, line 0, in ? File /opt/Zope/lib/python/DocumentTemplate/DT_Util.py, line 163, in careful_getitem I'm used to accounting for this error... usually by calling like in CALL 3... ### CALL 3 ### <dtml-let XYZ=Get_Self_Info> <dtml-var "XYZ['cpuLoading']"> </dtml-let> returns {'cpuLoading': 100.0} My question is... why is Zope returning the correct float the first time (CALL 1), but returning an entirely different float for CALL 3? Is there something I'm missing? Thanks in advance for your help. -Gary -- Gary Perez, (insert job title of choice) Mktg. Coord. + MIS Mgr. + Sys. Admin. Advanced Simulation Technology, inc. http://www.asti-usa.com/
Gary Perez wrote:
<dtml-var "Get_Self_Info['cpuLoading']">
That should probably be: <dtml-var "Get_Self_Info()['cpuLoading']"> You need to call your method if you went it to return its dictionary, just like in any other python ;-)
### CALL 3 ### <dtml-let XYZ=Get_Self_Info> <dtml-var "XYZ['cpuLoading']"> </dtml-let> returns {'cpuLoading': 100.0}
My question is... why is Zope returning the correct float the first time (CALL 1), but returning an entirely different float for CALL 3?
Any chance you could mail your Get_Self_Info method? cheers, Chris
participants (2)
-
Chris Withers -
Gary Perez