Skip to content

Commit

Permalink
fix #3: demos now working properly
Browse files Browse the repository at this point in the history
  • Loading branch information
evilkost committed Apr 13, 2011
1 parent a323af3 commit 4170e93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
15 changes: 6 additions & 9 deletions demos/bench/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions demos/websockets/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 4170e93

Please sign in to comment.