[Twisted-Python] LivePage patch? - was (LivePage CACHING Problem)

Justin Johnson justinjohnson at fastmail.fm
Mon Nov 17 14:19:29 EST 2003

Working with fzZzy on #divmod, I made the following change to my local
twisted/web/woven/flashconduit.py to make LivePage work for me.  I'm
using guard sessions (which appear to not be supported by the current
code) so in my case the sessions are stored on the SessionWrapper.  I
really don't know squat about the way the code should be, so hopefully
someone else can take a look at this and apply a real patch.  I'd gladly
do the real thing, but it would take me a *lot* longer to do.  :-)


--- flashconduit.py.orig        2003-11-17 13:18:37.000000000 -0600
+++ flashconduit.py     2003-11-17 13:18:43.000000000 -0600
@@ -16,7 +16,8 @@

     def lineReceived(self, line):
-        session = self.factory.site.getSession(line)
+        #session = self.factory.site.getSession(line)
+        session = self.factory.site.resource.sessions[line]
         self.lp = lp = session.getComponent(interfaces.IWovenLivePage)

----- Original message -----
From: "Justin Johnson" <justinjohnson at fastmail.fm>
To: "Twisted-Python" <twisted-python at twistedmatrix.com>
Date: Thu, 13 Nov 2003 11:19:09 -0600
Subject: Re: [Twisted-Python] LivePage CACHING Problem

I found the following post that looks similar to my problem.


But since I have my own tap, I copied the code from web/tap.py into my
code to start up the FlashConduitFactory.  It starts up, but I get the
following errors.  Is this a bug?  Any ideas what I'm doing wrong?

2003/11/13 11:08 CST [twisted.web.woven.flashconduit.FlashConduitFactory]
connection with flash movie opened
2003/11/13 11:08 CST [FlashConduit,3,xxx.xxx.xxx.xxx] Traceback (most
recent call last):
          line 501, in doSelect
            _logrun(selectable, _drdw, selectable, method, dict)
          line 65, in callWithLogger
            callWithContext({"system": lp}, func, *args, **kw)
          line 52, in callWithContext
            return context.call({ILogContext: newCtx}, func, *args, **kw)
          line 32, in callWithContext
            return func(*args,**kw)
        --- <exception caught here> ---
          line 510, in _doReadOrWrite
            why = getattr(selectable, method)()
          line 250, in doRead
            return self.protocol.dataReceived(data)
          line 223, in dataReceived
            why = self.lineReceived(line)
          line 19, in lineReceived
            session = self.factory.site.getSession(line)
          line 470, in getSession
            return self.sessions[uid]
        exceptions.KeyError: 'd01be6fe334cded345c0b029e29df7ac'

2003/11/13 11:08 CST [FlashConduit,3,xxx.xxx.xxx.xxx] connection lost

On Thu, 13 Nov 2003 10:38:59 -0600, "Justin Johnson"
<justinjohnson at fastmail.fm> said:
> Hi,
> I am currently trying to use LivePage to update the cells of an html
> table with results from processes initiated in various PB services.  The
> client intiates requests in the services and those services call back
> into the client's (a pb.Referenceable) remote_updateStatus method to
> update the table which displays the results.  I have test code that
> simulates this and everything works fine.  Javascript is sent to the
> browser to update the cells of the table.  Works really slick.  However,
> now that I tried to hook it up to PB, the LivePage javascript sending
> part isn't working.  When I make the page.sendScript(script) call I get
> the following in the log.
> 2003/11/13 10:25 CST [Broker,client] Sending javascript to page
> <twisted.web.woven.utils.WovenLivePage instance at 0x4089944c>
> 2003/11/13 10:25 CST [Broker,client] CACHING
> [<twisted.web.woven.utils.Script instance at 0x4089906c>]
> All future sendScript calls append the script to the cache.  Everything
> else is working appropriately, and all code is executing as I'd expect,
> except that the javascript doesn't send properly.  Is there something in
> particular I should be looking for here?  I don't see what I'm doing
> different, but since LivePage is quite magical to me I'm not sure where
> to look.
> On a slightly different note, is there LivePage-ish support in nevow, and
> do you recommend moving to that yet?
> Thanks.
> -Justin
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Twisted-Python mailing list
Twisted-Python at twistedmatrix.com

More information about the Twisted-Python mailing list