Hi, Florian Lindner wrote: > Hello, > I have the following situation: > > An object represents an RSS feed. It should be updated like every 20 minutes. > If there is something new a Jabber message should be send out. > > Currently I have it implemented with an scheduler loop that emits an > refreshRSSFeed event evey 20 minutes. My problem is that a handler for an > event must be a static function, but I want a handler function to be called > as a member of every instantiated RSS feed object. > > Another idea I have: > Implement an utility where the RSS feeds could register a function that is > called every 20 minutes. > Another way would be that this utility takes an URL and monitors the URL for > changes and only notifies the RSS Feed object in case of a change. > > How would you do that?
So there's two problems here: scheduling and notifying persistent objects about an event. I don't have a good idea about the scheduling right now, except the hint that using a 'zopectl run' script might be worthwhile. I'm not sure what a 'scheduler function is'. About notifying persistent objects: There is a method 'getAllUtilitiesRegisteredFor(interface)' which might help you. Have a look at zope/app/catalog/catalog.py beginning from line 150 (indexDocSubscriber) how the catalog handles events and dispatches them to multiple catalogs. I think this pretty much matches your use case if you make each RSS feed a (named) utility. Of course you could also have a utility that maintains references to all RSS feed objects and simply loops over them and calls a method for refreshing. Christian -- gocept gmbh & co. kg - forsterstraße 29 - 06112 halle/saale - germany www.gocept.com - [EMAIL PROTECTED] - phone +49 345 122 9889 7 - fax +49 345 122 9889 1 - zope and plone consulting and development
Description: OpenPGP digital signature
_______________________________________________ Zope3-users mailing list Zope3firstname.lastname@example.org http://mail.zope.org/mailman/listinfo/zope3-users