[Zope-dev] extending objectValues() and objectIds() or ?
Dennis Nichols
nichols@tradingconnections.com
Tue, 24 Oct 2000 09:59:19 -0500
I have developed a flock of Python products that have attributes
'first_date', 'last_date', and 'ok_to_publish' with the intention that
these attributes will be set by the content managers. Each product also has
an 'isPublishable' method that returns true if 'ok_to_publish' is true
_and_ today >= 'first_date' _and_ today <= 'last_date'. This all works fine
but I find myself writing DTML in many places to retrieve a list of objects
with objectValues() and then looping over them making yet another list of
only the objects that are publishable.
What I would really like is an objectValues() and an objectIds() that
return only publishable objects/ids. It looks like this could be easily
accomplished by {tremble} adding an additional parameter to those two
routines, say chkPub=None so that I could do a call such as
objectValues('Poll',1) when I wanted just the publishable Poll items
returned. However...
1. modifying ObjectManager.py doesn't seem like the best move I've ever
thought of
2. I'm confused about the ObjectManager internals - can I call my
isPublishable methods on objects that ObjectManager keeps in its lists? How?
I guess a better question, rather than asking about this one possible
solution, would be:
How can I extend Zope to give me a list of objects qualified by more than
just the meta_type?
Guidance gleefully gathered. Thanks!
--
Dennis Nichols
nichols@tradingconnections.com