Am Dienstag, 19. Dezember 2006 08:17 schrieb Christian Theune: > 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.
No, only the notifying problem. > 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'. I use the scheduler package from the Zope3 trunk and so far it works for me. > 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. The RSS feed is a object that users could add and remove to arbitrary (sub-folders of there home-dir) folders. I would rather regard it as content object and I don't like adding utilities to content space (I have never really understood why content- and software-space have been mixed up). It would be possible, I think even technically superior to the next solution but somehome I don't like. > 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. That's something I had mentioned in my posting too. It has advantage that the feeds could decide if they want to be called or not, whereas by the "utility-way" they would always be called. Thanks for your input, Florian _______________________________________________ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users