Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions examples/tornado/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,22 @@
from tornado import web, gen
from restless.tnd import TornadoResource

class PetResource(TornadoResource):

class BaseHandler(web.RequestHandler):

def prepare(self):
self.fake_db = {
""" do normal tornado preparation """

def initialize(self):
""" do your tornado initialization """

class PetResource(TornadoResource):

# bind BaseHandler instead of tornado.web.RequestHandler
_request_handler_base_ = BaseHandler

def __init__(self):
self.fake_db = [
{
"id": 1,
"name": "Mitti",
Expand All @@ -15,7 +28,8 @@ def prepare(self):
"name": "Gary",
"type": "cat"
}
}
]


@gen.coroutine
def list(self):
Expand Down