##// END OF EJS Templates
Added tag v5.3.1 for changeset 14c68b1b77eb
Added tag v5.3.1 for changeset 14c68b1b77eb

File last commit:

r1152:a0c49580 default
r1307:beb57121 stable
Show More
echo_app.py
56 lines | 1.5 KiB | text/x-python | PythonLexer
source-code: updated copyrights to 2023
r1126 # Copyright (C) 2014-2023 RhodeCode GmbH
initial commit
r0 """
Implementation of :class:`EchoApp`.
This WSGI application will just echo back the data which it recieves.
"""
import logging
log = logging.getLogger(__name__)
lint: auto-fixes
r1152 class EchoApp:
initial commit
r0
def __init__(self, repo_path, repo_name, config):
self._repo_path = repo_path
log.info("EchoApp initialized for %s", repo_path)
def __call__(self, environ, start_response):
log.debug("EchoApp called for %s", self._repo_path)
log.debug("Content-Length: %s", environ.get('CONTENT_LENGTH'))
environ['wsgi.input'].read()
status = '200 OK'
tests: make sure echo_app returns proper content type
r246 headers = [('Content-Type', 'text/plain')]
initial commit
r0 start_response(status, headers)
python3: code change for py3 support...
r1048 return [b"ECHO"]
initial commit
r0
lint: auto-fixes
r1152 class EchoAppStream:
vcsserver: added stream EchoApp for testing
r248
def __init__(self, repo_path, repo_name, config):
self._repo_path = repo_path
log.info("EchoApp initialized for %s", repo_path)
def __call__(self, environ, start_response):
log.debug("EchoApp called for %s", self._repo_path)
log.debug("Content-Length: %s", environ.get('CONTENT_LENGTH'))
environ['wsgi.input'].read()
status = '200 OK'
headers = [('Content-Type', 'text/plain')]
start_response(status, headers)
def generator():
py3: drop xrange
r982 for _ in range(1000000):
python3: code change for py3 support...
r1048 yield b"ECHO_STREAM"
vcsserver: added stream EchoApp for testing
r248 return generator()
initial commit
r0 def create_app():
"""
Allows to run this app directly in a WSGI server.
"""
stub_config = {}
return EchoApp('stub_path', 'stub_name', stub_config)