Here's a patch to add script buffering to liveevil.py. One additional change is needed, but I'm not sure where to put it. self.output needs to be reset to None when the connection is closed. Currently I'm getting around this by using liveevil as the mind and setting mind.output = None in my render_ method where I know I can reset it before using liveevil again. Anyone have any ideas for a better place to reset this? Index: liveevil.py =================================================================== RCS file: /cvs/Quotient/nevow/liveevil.py,v retrieving revision 1.2 diff -u -r1.2 liveevil.py --- liveevil.py 26 Jan 2004 18:30:12 -0000 1.2 +++ liveevil.py 17 Feb 2004 19:19:41 -0000 @@ -38,11 +38,16 @@ # TODO set up an event hub self.events = events.EventNotification() self.hookupNotifications = [] + self.outputBuffer = [] def hookupOutput(self, output, finisher = None): #print "output hooked up." self.output = output self.finisher = finisher + for buf in self.outputBuffer: + output(buf) + #print "Sent buffered item: ", buf + self.outputBuffer = [] for notify in self.hookupNotifications: notify(self) @@ -51,9 +56,11 @@ def sendScript(self, script): if self.output: + #print "output sent!", script self.output(script) else: - print "output ignored!", script + self.outputBuffer.append(script) + #print "output buffered!", script def handleInput(self, identifier, *args): #self.sendScript(input)
participants (1)
-
Justin Johnson