[Zope-dev] ZPatterns: getItem returns None

Steve Spicklemire steve@spvi.com
Mon, 19 Mar 2001 20:12:02 -0500 (EST)


Hi Roche,

> > In all simplicity I still can't get it to work but here's some more info
> > from the console:
> >
> > Traceback (innermost last):
> >   File
> > C:\PROGRA~1\ZOPE230\lib\python\Products\ZPatterns\AttributeProviders.py,
> > line 335, in _AttributeFor
> >     (Object: GAPMixin)
> >   File C:\PROGRA~1\ZOPE230\lib\python\Products\ZPatterns\Expressions.py,
> > line 13
> > 6, in eval
> > KeyError: AllotmentArea_ID
>

Seems like the first element of the list of result objects returned by 
sqlGetAllotmentArea doesn't define anything called 'AllotmentArea_ID'.
Could it be a case problem? What datbase/db_adaptor are you using?

You might try changing the skin-script to something like:

WITH (myDebuggingMethod(test_id = self.id) or [NOT_FOUND])[0] COMPUTE AllotmentArea_ID, AreaName, AreaCode

then have myDebuggingMethod call an external method to 'print' out things like
the id being used, and the contents of the results being passed back to the
attribute provider. This same method could also return a 'static' dictionary
in a list that has AllotmentArea_ID, AreaName, AreaCode defined as keys, so 
that you know they are there. There was also an exchange on the list between 
Joachim Schmitz and me back in October about some debugging strageties.
You might try to dig those up... 

-steve