[Twisted-Python] Twisted and MVC
mail.sensenmann at googlemail.com
Mon Dec 15 07:22:38 EST 2008
Well ... you're just right but the code is still closed atm so you have to
be happy with some snippets. I left out unimportant functions and replaced
names with representatives.
import model, view
self.model = model.Client(self)
self.view = view.view(self)
print 'connection established'
And finaly the model.py:
from twisted.internet import reactor, protocol, task, ssl
from twisted.protocols import basic
class Client(basic.LineOnlyReceiver, protocol.Factory):
"""Takes one argument: the instance of the controller Class."""
"""Initiate the connection."""
reactor.connectSSL(server, port, self, ssl.ClientContextFactory())
def buildProtocol(self, addr):
"""The Handshake has to be send first, after a ssl connection is
self.sendLine('line to that the server respond with another line')
2008/12/15 Valentino Volonghi <dialtone at gmail.com>
> On Dec 14, 2008, at 9:38 PM, Christian Scharkus wrote:
> methods of the instance and send messages to the server. So how do I
> the model to he server? In former implementations I were using the
> Clientfactory but this didn't work very well.
> <mode yoda>
> Use the code Luke
> </mode yoda>
> Without showing the code it's hard to give an help. Anyway it's the
> responsibility of the protocol to translate a line into a controller call,
> and the controller should then consider calling something on the
> model but again without the code it's pretty hard to guess which is
> edge A5 and which is panel G3. :)
> Valentino Volonghi aka Dialtone
> Now running MacOS X 10.5
> Home Page: http://www.twisted.it
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python