~certify-web-dev/twisted/certify-trunk

« back to all changes in this revision

Viewing changes to twisted/web/woven/flashconduit.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-01-17 14:52:35 UTC
  • mfrom: (1.1.5 upstream) (2.1.2 etch)
  • Revision ID: james.westby@ubuntu.com-20070117145235-btmig6qfmqfen0om
Tags: 2.5.0-0ubuntu1
New upstream version, compatible with python2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from twisted.internet.protocol import Factory
 
2
from twisted.protocols.basic import LineReceiver
 
3
from twisted.python import log
 
4
from twisted.web.woven import interfaces
 
5
 
 
6
 
 
7
class FlashConduit(LineReceiver):
 
8
    delimiter = '\0'
 
9
    keepalive = 1
 
10
    def connectionMade(self):
 
11
        print "connection with flash movie opened"
 
12
        #self.transport.write("alert('helllllllo')\0")
 
13
 
 
14
    def connectionLost(self, reason):
 
15
        print "connection lost"
 
16
        #self.lp.unhookOutputConduit()
 
17
 
 
18
    def lineReceived(self, line):
 
19
        session = self.factory.site.getSession(line)
 
20
        self.lp = lp = session.getComponent(interfaces.IWovenLivePage)
 
21
        lp.hookupOutputConduit(self)
 
22
 
 
23
    def writeScript(self, data):
 
24
        #print "writing javascript", data
 
25
        self.transport.write(data + '\0')
 
26
    
 
27
    def finish(self):
 
28
        pass
 
29
 
 
30
 
 
31
class FlashConduitFactory(Factory):
 
32
    protocol = FlashConduit
 
33
 
 
34
    def __init__(self, site):
 
35
        self.site = site
 
 
b'\\ No newline at end of file'