summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDenis Bilenko <denis@ag-projects.com>2008-11-03 21:13:37 +0600
committerDenis Bilenko <denis@ag-projects.com>2008-11-03 21:13:37 +0600
commit25963c366b5b377186afe4e6d260efa979d0c875 (patch)
tree6c5cfaab44611cd37706168f411fcede5f8f8cab /examples
parentc734ca9bd86f95aa25ee8cebf6c5b4fd1c2194f2 (diff)
downloadeventlet-25963c366b5b377186afe4e6d260efa979d0c875.tar.gz
fixed twisted examples to use the updated twisteds.basic api
Diffstat (limited to 'examples')
-rw-r--r--examples/twisted_basic_client.py4
-rw-r--r--examples/twisted_basic_server.py2
-rw-r--r--examples/twisted_xcap_proxy.py4
3 files changed, 5 insertions, 5 deletions
diff --git a/examples/twisted_basic_client.py b/examples/twisted_basic_client.py
index f5282df..948c214 100644
--- a/examples/twisted_basic_client.py
+++ b/examples/twisted_basic_client.py
@@ -1,7 +1,7 @@
from eventlet.twisteds import basic
-conn = basic.connectTCP(basic.line_only_receiver, 'www.google.com', 80)
-conn.send('GET / HTTP/1.0\r\n\r\n')
+conn = basic.connectTCP('www.google.com', 80, buffer_class=basic.line_only_receiver)
+conn.write('GET / HTTP/1.0\r\n\r\n')
for line in conn:
print line
diff --git a/examples/twisted_basic_server.py b/examples/twisted_basic_server.py
index 6af8b7e..3b32e79 100644
--- a/examples/twisted_basic_server.py
+++ b/examples/twisted_basic_server.py
@@ -24,6 +24,6 @@ class Chat:
self.participants.remove(conn)
chat = Chat()
-basic.listenTCP(basic.line_only_receiver, chat.handler, 8007)
+basic.listenTCP(8007, chat.handler, 8007, buffer_class=basic.line_only_receiver)
from twisted.internet import reactor
reactor.run()
diff --git a/examples/twisted_xcap_proxy.py b/examples/twisted_xcap_proxy.py
index 729dacc..a1475e0 100644
--- a/examples/twisted_xcap_proxy.py
+++ b/examples/twisted_xcap_proxy.py
@@ -4,7 +4,7 @@ from twisted.protocols import basic
from xcaplib.green import XCAPClient
-from eventlet.twisteds.util import callInGreenThread
+from eventlet.twisteds.util import deferToGreenThread
from eventlet.twisteds import join_reactor
class LineOnlyReceiver(basic.LineOnlyReceiver):
@@ -15,7 +15,7 @@ class LineOnlyReceiver(basic.LineOnlyReceiver):
return
app, context, node = (line + ' ').split(' ', 3)
context = {'u' : 'users', 'g': 'global'}.get(context, context)
- d = callInGreenThread(client._get, app, node, globaltree=context=='global')
+ d = deferToGreenThread(client._get, app, node, globaltree=context=='global')
def callback(result):
self.transport.write(str(result))
def errback(error):