parameters: (self, prefix, app, **options)
docstring: Mount an application (:class:`Bottle` or plain WSGI) to a specific
              URL prefix. Example::
  
                  root_app.mount('/admin/', admin_app)
  
              :param prefix: path prefix or `mount-point`. If it ends in a slash,
                  that slash is mandatory.
              :param app: an instance of :class:`Bottle` or a WSGI application.
  
              All other parameters are passed to the underlying :meth:`route` call.
docstring_summary: Mount an application (:class:`Bottle` or plain WSGI) to a specific
              URL prefix. Example::
docstring_tokens: Mount an application ( : class : Bottle or plain WSGI ) to a specific URL prefix . Example ::
function: def mount(self, prefix, app, **options):
          ''' Mount an application (:class:`Bottle` or plain WSGI) to a specific
              URL prefix. Example::
  
                  root_app.mount('/admin/', admin_app)
  
              :param prefix: path prefix or `mount-point`. If it ends in a slash,
                  that slash is mandatory.
              :param app: an instance of :class:`Bottle` or a WSGI application.
  
              All other parameters are passed to the underlying :meth:`route` call.
          '''
          if isinstance(app, basestring):
              depr('Parameter order of Bottle.mount() changed.', True) # 0.10
  
          segments = [p for p in prefix.split('/') if p]
          if not segments: raise ValueError('Empty path prefix.')
          path_depth = len(segments)
  
          def mountpoint_wrapper():
              try:
                  request.path_shift(path_depth)
                  rs = HTTPResponse([])
                  def start_response(status, headerlist, exc_info=None):
                      if exc_info:
                          try:
                              _raise(*exc_info)
                          finally:
                              exc_info = None
                      rs.status = status
                      for name, value in headerlist: rs.add_header(name, value)
                      return rs.body.append
                  body = app(request.environ, start_response)
                  if body and rs.body: body = itertools.chain(rs.body, body)
                  rs.body = body or rs.body
                  return rs
              finally:
                  request.path_shift(-path_depth)
  
          options.setdefault('skip', True)
          options.setdefault('method', 'PROXY')
          options.setdefault('mountpoint', {'prefix': prefix, 'target': app})
          options['callback'] = mountpoint_wrapper
  
          self.route('/%s/<:re:.*>' % '/'.join(segments), **options)
          if not prefix.endswith('/'):
              self.route('/' + '/'.join(segments), **options)
function_tokens: def mount ( self , prefix , app , * * options ) : if isinstance ( app , basestring ) : depr ( 'Parameter order of Bottle.mount() changed.' , True ) # 0.10 segments = [ p for p in prefix . split ( '/' ) if p ] if not segments : raise ValueError ( 'Empty path prefix.' ) path_depth = len ( segments ) def mountpoint_wrapper ( ) : try : request . path_shift ( path_depth ) rs = HTTPResponse ( [ ] ) def start_response ( status , headerlist , exc_info = None ) : if exc_info : try : _raise ( * exc_info ) finally : exc_info = None rs . status = status for name , value in headerlist : rs . add_header ( name , value ) return rs . body . append body = app ( request . environ , start_response ) if body and rs . body : body = itertools . chain ( rs . body , body ) rs . body = body or rs . body return rs finally : request . path_shift ( - path_depth ) options . setdefault ( 'skip' , True ) options . setdefault ( 'method' , 'PROXY' ) options . setdefault ( 'mountpoint' , { 'prefix' : prefix , 'target' : app } ) options [ 'callback' ] = mountpoint_wrapper self . route ( '/%s/<:re:.*>' % '/' . join ( segments ) , * * options ) if not prefix . endswith ( '/' ) : self . route ( '/' + '/' . join ( segments ) , * * options )