Trees | Indices | Help |
|
---|
|
1 ########################################################################### 2 # 3 # This program is part of Zenoss Core, an open source monitoring platform. 4 # Copyright (C) 2007, Zenoss Inc. 5 # 6 # This program is free software; you can redistribute it and/or modify it 7 # under the terms of the GNU General Public License version 2 as published by 8 # the Free Software Foundation. 9 # 10 # For complete information please visit: http://www.zenoss.com/oss/ 11 # 12 ########################################################################### 13 #! /usr/bin/env python 14 15 __doc__='''Chain 16 17 Chain a series of deferred actions serially. 18 19 $Id$ 20 ''' 21 22 __version__ = "$Revision$"[11:-2] 23 24 25 26 from twisted.internet import defer 2729 """Call a function over an interable of data, after each finishes.""" 306032 self.callable = callable 33 self.iterable = iterable 34 self.results = [] 35 self.defer = defer.Deferred()36 4042 "run the next step" 43 try: 44 next = self.iterable.next() 45 self.callable(next).addCallbacks(self.success, self.failure) 46 except StopIteration: 47 self.defer.callback(self.results) 48 except Exception, ex: 49 self.failure(ex)50 55
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Thu Oct 25 16:28:42 2007 | http://epydoc.sourceforge.net |