code
stringlengths
3
6.57k
list(enumerate(self.plugins)
type(plugin)
getattr(plugin, 'name', True)
removed.append(plugin)
hasattr(plugin, 'close')
plugin.close()
self.reset()
reset(self, route=None)
routes (force plugins to be re-applied)
isinstance(route, Route)
route.reset()
route.prepare()
self.trigger_hook('app_reset')
close(self)
hasattr(plugin, 'close')
plugin.close()
run(self, **kwargs)
run(self, **kwargs)
match(self, environ)
a (:class:`Route` , urlargs)
self.router.match(environ)
get_url(self, routename, **kargs)
request.environ.get('SCRIPT_NAME', '')
strip('/')
self.router.build(routename, **kargs)
lstrip('/')
urljoin(urljoin('/', scriptname)
add_route(self, route)
self.routes.append(route)
self.router.add(route.rule, route.method, route, name=route.name)
route.prepare()
app.route('/hello/<name>')
hello(name)
method (`GET`, `POST`, `PUT`, ...)
to. (default: `GET`)
route(..., callback=func)
route(...)
route. (default: None)
plugins (see :meth:`Plugin.apply`)
callable(path)
makelist(apply)
makelist(skip)
decorator(callback)
isinstance(callback, basestring)
load(callback)
makelist(path)
yieldroutes(callback)
makelist(method)
verb.upper()
self.add_route(route)
decorator(callback)
get(self, path=None, method='GET', **options)
self.route(path, method, **options)
post(self, path=None, method='POST', **options)
self.route(path, method, **options)
put(self, path=None, method='PUT', **options)
self.route(path, method, **options)
delete(self, path=None, method='DELETE', **options)
self.route(path, method, **options)
patch(self, path=None, method='PATCH', **options)
self.route(path, method, **options)
error(self, code=500)
wrapper(handler)
int(code)
default_error_handler(self, res)
tob(template(ERROR_PAGE_TEMPLATE, e=res)
_handle(self, environ)
path.encode('latin1')
decode('utf8')
HTTPError(400, 'Invalid path string. Expected UTF-8')
request.bind(environ)
response.bind()
self.trigger_hook('before_request')
self.router.match(environ)
route.call(**args)
self.trigger_hook('after_request')
_e()
route.reset()
self._handle(environ)
except (KeyboardInterrupt, SystemExit, MemoryError)
format_exc()
write(stacktrace)
HTTPError(500, "Internal Server Error", _e()
_cast(self, out, peek=None)
isinstance(out, (tuple, list)
isinstance(out[0], (bytes, unicode)
join(out)
isinstance(out, unicode)
out.encode(response.charset)
isinstance(out, bytes)
len(out)
HTTPException (recursive, because they may wrap anything)
handle()
isinstance(out, HTTPError)
out.apply(response)
self.error_handler.get(out.status_code, self.default_error_handler)
self._cast(out)
isinstance(out, HTTPResponse)
out.apply(response)
self._cast(out.body)