[Zope-CMF] Re: PROPOSAL: implement synContentValues in CMFTopic

Tres Seaver tseaver at zope.com
Mon Jun 7 11:38:15 EDT 2004


Petri Savolainen wrote:
> Oh well. The following:
> 
> 
>>    def synContentValues(self):
>>        return [result for result in self.queryCatalog()]
> 
> 
> Should of course be:
> 
>      def synContentValues(self):
>          return [result.getObject() for result in self.queryCatalog()]
> 
> 
> Sorry for the mistake. Any other gotchas I missed?

We *really* don't want to call 'getObject' on each brain of an 
arbitrarily long catalog query result set.  So, we should probably do 
something like:

     def synContentValues( self ):

         """ See Syndicatable.
         """
         syn_tool = getToolByName( self, 'portal_syndication' )
         limit = syn_tool.getMaxItems( self )
         brains = self.queryCatalog( sort_limit=limit )[ :limit ]
         return [ brain.getObject() for brain in brains ]

Please submit your feature request at the CMF collector:

   http://zope.org/Collectors/CMF

Tres.
-- 
===============================================================
Tres Seaver                                tseaver at zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com




More information about the Zope-CMF mailing list