[Twisted-Python] reflector init

Jonathan M. Lange jml at mumak.net
Wed Oct 30 20:05:46 EST 2002


On Thu, Oct 31, 2002 at 11:33:01AM +1100, Jonathan M. Lange wrote:
> Suggestions include having a populatedDeferred as a member (rather than
> populatedCallback)

patches :)

Index: twisted/enterprise/reflector.py
===================================================================
RCS file: /cvs/Twisted/twisted/enterprise/reflector.py,v
retrieving revision 1.9
diff -u -r1.9 reflector.py
--- twisted/enterprise/reflector.py	16 Oct 2002 04:27:29 -0000	1.9
+++ twisted/enterprise/reflector.py	31 Oct 2002 00:57:59 -0000
@@ -20,6 +20,7 @@
 from twisted.enterprise import adbapi
 from twisted.enterprise.util import DBError, getKeyColumn, quote, _TableInfo, _TableRelationship
 from twisted.enterprise.row import RowObject
+from twisted.internet import defer
 
 class Reflector:
     """Base class for enterprise reflectors. This implements rowCacheing.
@@ -61,6 +62,7 @@
         
         from twisted.internet import reactor
         reactor.callLater(0, self._really_populate)
+        self.populatedDeferred = defer.Deferred()
 
     def _really_populate(self):
         """Implement me to populate schema information for the reflector.
Index: twisted/enterprise/sqlreflector.py
===================================================================
RCS file: /cvs/Twisted/twisted/enterprise/sqlreflector.py,v
retrieving revision 1.10
diff -u -r1.10 sqlreflector.py
--- twisted/enterprise/sqlreflector.py	14 Oct 2002 22:34:21 -0000	1.10
+++ twisted/enterprise/sqlreflector.py	31 Oct 2002 00:58:00 -0000
@@ -49,6 +49,7 @@
         defe = self.runInteraction(self._transPopulateSchema)
         if self.populatedCallback:
             defe.addCallbacks(self.populatedCallback)
+        defe.chainDeferred(self.populatedDeferred)
 
     def _transPopulateSchema(self, transaction):
         """Used to construct the row classes in a single interaction.





More information about the Twisted-Python mailing list