[Zope] Namespace problems

Justin Stockton JStockton@DevIS.com
Tue, 27 Feb 2001 16:12:40 -0500


I have python method that is passed a list of country abbreviations.  I want
to be able to loop through this list and send each item to a ZSQL, but for
some reason I keep getting Name and Key Errors.

Here is what I have so far:

--
<dtml-in geoList>
  <dtml-var "SQL.getSiteID(geoName=_[_['sequence-item']])">
</dtml-in>
--
where geoList is a list "['TC', 'AG', 'AN', 'AB']"
and getSiteID is the ZSQL method : select * from siteid where left(siteid,
2) = <dtml-sqlvar geoName type=string>

This yield the following error:
--
Zope has encountered an error while publishing this resource. 

Error Type: KeyError
Error Value: TC

Traceback (innermost last):
  File /usr/local/Zope-2.1.6-linux2-x86/lib/python/ZPublisher/Publish.py,
line 214, in publish_module
  File /usr/local/Zope-2.1.6-linux2-x86/lib/python/ZPublisher/Publish.py,
line 179, in publish
  File /usr/local/Zope-2.1.6-linux2-x86/lib/python/Zope/__init__.py, line
202, in zpublisher_exception_hook
    (Object: ElementWithAttributes)
  File /usr/local/Zope-2.1.6-linux2-x86/lib/python/ZPublisher/Publish.py,
line 165, in publish
  File /usr/local/Zope-2.1.6-linux2-x86/lib/python/ZPublisher/mapply.py,
line 160, in mapply
    (Object: showGeoInfo)
  File /usr/local/Zope-2.1.6-linux2-x86/lib/python/ZPublisher/Publish.py,
line 102, in call_object
    (Object: showGeoInfo)
  File /usr/local/Zope-2.1.6-linux2-x86/lib/python/OFS/DTMLMethod.py, line
150, in __call__
    (Object: showGeoInfo)
  File
/usr/local/Zope-2.1.6-linux2-x86/lib/python/DocumentTemplate/DT_String.py,
line 502, in __call__
    (Object: showGeoInfo)
  File
/usr/local/Zope-2.1.6-linux2-x86/lib/python/DocumentTemplate/DT_In.py, line
691, in renderwob
    (Object: geoList)
  File
/usr/local/Zope-2.1.6-linux2-x86/lib/python/DocumentTemplate/DT_Util.py,
line 335, in eval
    (Object: SQL.getSiteID(geoName=_[_['sequence-item']]))
    (Info: _)
  File <string>, line 0, in ?
  File
/usr/local/Zope-2.1.6-linux2-x86/lib/python/DocumentTemplate/DT_Util.py,
line 161, in careful_getitem
KeyError: (see above)
--

thanks in advance for any help

- Justin