[Zope] Problems with list of object references

Sven Rudolph rudolph@medical-tribune.de
Wed, 14 Aug 2002 11:22:45 +0200


Hello Max,


> Then I would probably create a list of the 100 most recent articles. You 
> can create a product that holds a single list "latestNews".

This is what I'm currently doing, as you can see in my initial posting.


> Then have a 
> method something like this to add the news items to:
> 
> def addDateItem(self, itm):
>     news = self.latestNews
>     news.append(news.getPhysicalPath())
>     if len(news) > 100:
>         news.remove(100)
>     self.latestNews = news
> 
> def getLatestNews(self):
>     # converts paths to objects
>     return [self.getPhysicalRoot().restrictedTraverse(path) for path in 
> self.latestNews]

I do exactly the same in my buffer product, but with different code.
The problem with this method is, that I have to call self.getPhysicalRoot().restrictedTraverse(path) 100 times every time I call getLatestNews, and this is to slow :-(

I was thinking about your suggestion to use ZCatalog. Isn't the attribute data_record_id_ some kind of object reference? It seems to be unique and static. Do you now how it is generated?

Greetings

Sven

-- 
Sven Rudolph, Programmierer
GermanMedicalServices.de GmbH
Unter den Eichen 5, 65195 Wiesbaden
Tel.: 06 11 / 97 46 25 2