[Zope] Product data acquisition by <dtml-var>

Chris Withers chris at simplistix.co.uk
Fri Apr 22 04:03:09 EDT 2005


Anders Karlsson wrote:

> I am working some on a product where I have some problems making a nice 
> interface to the calling dtml-code. My product grabs and caches RSS data for 
> a feed, and now I would like to make an interface much like the one that is 
> provided by the "Z SQL Method".

Like ZSQL method in what respect exactly?

> My problem is that I can't find any 
> documentation or examples of how to make this work with the acquisition.

What "this" are you referring to?

> I have found out that I in my product class can have a __len__() function that 
> returns the result size and a __getitem__() function that returns a numbered 
> element. If I return a mapping from that function I can access the resulting 
> values as I want, but to make it work I need to add the "mapping" attribute 
> to my <dtml-in>-tag. I would like to get the same result without having to 
> tell dtml-in that it's a mapping, just like "Z SQL Method" does. 

Then looks at returning Result objects, or whatever theyr'e called, like 
ZSQL methods do...

> objects of a result class from the __getitem__() function. Is there any 
> specifications telling which functions such a class needs to implement?

Nope, I'd suggest you just re-use that class, since it likely does 
exactly what you want ;-)

>    Error Value: unbound Python method must be called with RSSItem 1st argument

Okay, so lets see a full traceback and the code the traceback refers to.

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk



More information about the Zope mailing list