[Zope] Re: returning related objects

VanL vlindberg@verio.net
Tue, 10 Sep 2002 13:05:28 -0600


Thanks,  I am trying your method.  I have defined in my python products 
'get_Field()', 'get_Orchard()', 'get_Manager(''), etc.  These functions 
return the associated object.  

However, when I try to run these, I get an error:

The calling form looks like this:

<dtml-in expr="DTMLQuery(search=REQUEST.form)">
<dtml-var sequence-item>
<dtml-in>

DTMLQuery is bombing out on the following function:

def doAQ(resultlist):
    if control['relation'] == 'self': return resultlist
    else:
        aqresults = []
        if control['relation'] == 'manager':
            for res in resultlist:
                aqresults.append(res.get_Manager())
        else:
            assert control['relation'] == 'field'
            for res in resultlist:
                aqresults.append(res.get_Field())
   
    return aqresults

This is called friom the line:
return doAQ(doQuery(postProcess(search)))

I also tried this with list comprehensions, and got the same result 
(just in case I was doing something boneheaded)

I have confirmed that the query works, and the get_Manager (etc) 
functions have worked in a different context.  Rather, Zope gives the 
following error message:

*Error Type: RuntimeError*
*Error Value: function attributes not accessible in restricted mode

Zope gives this message as soon as I try to access the member functions 
for the types I have defined.  I'm confused abo*ut the error message; 
I'm not trying to access a function attribute, AFAIK.  Rather, this is a 
class function.

Any help?

Thanks,

VanL