"""
SUPPORTED_METHODS = ("GET", "HEAD", "POST", "DELETE", "PUT")
- def __init__(self, application, request):
+ def __init__(self, application, request, **kwargs):
self.application = application
self.request = request
self._headers_written = False
if hasattr(self.request, "connection"):
self.request.connection.stream.set_close_callback(
self.on_connection_close)
+ self.initialize(**kwargs)
+
+ def initialize(self):
+ """Hook for subclass initialization.
+
+ A dictionary passed as the third argument of a url spec will be
+ supplied as keyword arguments to initialize().
+
+ Example:
+ class ProfileHandler(RequestHandler):
+ def initialize(self, database):
+ self.database = database
+
+ def get(self, username):
+ ...
+
+ app = Application([
+ (r'/user/(.*)', ProfileHandler, dict(database=database)),
+ ])
+ """
+ pass
@property
def settings(self):