Skip to content
Browse files

fix #3: demos now working properly

  • Loading branch information...
1 parent a323af3 commit 4170e938d2061c0e849f3053ede1b3eecd40423c @evilkost committed Apr 13, 2011
Showing with 7 additions and 12 deletions.
  1. +6 −9 demos/bench/app.py
  2. +1 −3 demos/websockets/app.py
View
15 demos/bench/app.py
@@ -3,20 +3,17 @@
import tornado.web
import tornado.websocket
import tornado.ioloop
-from functools import partial
import redis
+REDIS_HOST = 'localhost'
+REDIS_PORT = 6379
-r = redis.Redis(db=9)
+r = redis.Redis(REDIS_HOST, REDIS_PORT, db=9)
-
-async = partial(brukva.adisp.async, cbname='callbacks')
-
-
-c = brukva.Client()
+c = brukva.Client(REDIS_HOST, REDIS_PORT)
c.connect()
-
c.select(9)
+
c.set('foo', 'bar')
c.set('foo2', 'bar2')
@@ -25,7 +22,7 @@ class BrukvaHandler(tornado.web.RequestHandler):
@tornado.web.asynchronous
@brukva.adisp.process
def get(self):
- ((_, foo), (_, foo2)) = yield [ async(c.get)('foo'), async(c.get)('foo2') ]
+ foo, foo2 = yield [c.async.get('foo'), c.async.get('foo2')]
self.set_header('Content-Type', 'text/plain')
self.write(foo)
self.write(foo2)
View
4 demos/websockets/app.py
@@ -41,9 +41,7 @@ def open(self):
self.client.listen(self.on_message)
def on_message(self, result):
- (error, data) = result
- if not error:
- self.write_message(str(data.body))
+ self.write_message(str(result.body))
def close(self):
self.client.unsubscribe('test_channel')

0 comments on commit 4170e93

Please sign in to comment.
Something went wrong with that request. Please try again.