parameters: (self, pattern, handler, **kwargs)
docstring: Adds the given *handler* (`tornado.web.RequestHandler`) to the Tornado
          Application (`self.ws.application`) to handle URLs matching *pattern*.
          If given, *kwargs* will be added to the `tornado.web.URLSpec` when the
          complete handler is assembled.
  
          .. note::
  
              If the *pattern* does not start with the configured `url_prefix` it
              will be automatically prepended.
docstring_summary: Adds the given *handler* (`tornado.web.RequestHandler`) to the Tornado
          Application (`self.ws.application`) to handle URLs matching *pattern*.
          If given, *kwargs* will be added to the `tornado.web.URLSpec` when the
          complete handler is assembled.
docstring_tokens: Adds the given * handler * ( tornado . web . RequestHandler ) to the Tornado Application ( self . ws . application ) to handle URLs matching * pattern * . If given * kwargs * will be added to the tornado . web . URLSpec when the complete handler is assembled .
function: def add_handler(self, pattern, handler, **kwargs):
          """
          Adds the given *handler* (`tornado.web.RequestHandler`) to the Tornado
          Application (`self.ws.application`) to handle URLs matching *pattern*.
          If given, *kwargs* will be added to the `tornado.web.URLSpec` when the
          complete handler is assembled.
  
          .. note::
  
              If the *pattern* does not start with the configured `url_prefix` it
              will be automatically prepended.
          """
          logging.debug("Adding handler: (%s, %s)" % (pattern, handler))
          url_prefix = self.ws.settings['url_prefix']
          if not pattern.startswith(url_prefix):
              if pattern.startswith('/'):
                  # Get rid of the / (it will be in the url_prefix)
                  pattern = pattern.lstrip('/')
          spec = tornado.web.URLSpec(pattern, handler, kwargs)
          # Why the Tornado devs didn't give us a simple way to do this is beyond
          # me.
          self.ws.application.handlers[0][1].append(spec)
function_tokens: def add_handler ( self , pattern , handler , * * kwargs ) : logging . debug ( "Adding handler: (%s, %s)" % ( pattern , handler ) ) url_prefix = self . ws . settings [ 'url_prefix' ] if not pattern . startswith ( url_prefix ) : if pattern . startswith ( '/' ) : # Get rid of the / (it will be in the url_prefix) pattern = pattern . lstrip ( '/' ) spec = tornado . web . URLSpec ( pattern , handler , kwargs ) # Why the Tornado devs didn't give us a simple way to do this is beyond # me. self . ws . application . handlers [ 0 ] [ 1 ] . append ( spec )