MCPcopy Create free account
hub / github.com/datapane/datapane / mountpoint_wrapper

Method mountpoint_wrapper

python-client/src/datapane/_vendor/bottle.py:703–727  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

701 path_depth = len(segments)
702
703 def mountpoint_wrapper():
704 try:
705 request.path_shift(path_depth)
706 rs = HTTPResponse([])
707
708 def start_response(status, headerlist, exc_info=None):
709 if exc_info:
710 _raise(*exc_info)
711 if py3k:
712 # Errors here mean that the mounted WSGI app did not
713 # follow PEP-3333 (which requires latin1) or used a
714 # pre-encoding other than utf8 :/
715 status = status.encode('latin1').decode('utf8')
716 headerlist = [(k, v.encode('latin1').decode('utf8'))
717 for (k, v) in headerlist]
718 rs.status = status
719 for name, value in headerlist:
720 rs.add_header(name, value)
721 return rs.body.append
722
723 body = app(request.environ, start_response)
724 rs.body = itertools.chain(rs.body, body) if rs.body else body
725 return rs
726 finally:
727 request.path_shift(-path_depth)
728
729 options.setdefault('skip', True)
730 options.setdefault('method', 'PROXY')

Callers

nothing calls this directly

Calls 2

HTTPResponseClass · 0.85
path_shiftMethod · 0.80

Tested by

no test coverage detected