##// END OF EJS Templates
hooks: fix case for SSH hooks executed in certain condition with errors....
hooks: fix case for SSH hooks executed in certain condition with errors. - forking/PR open

File last commit:

r248:55f1a734 default
r334:5e1182e3 stable
Show More
echo_app.py
54 lines | 1.5 KiB | text/x-python | PythonLexer
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__)
class EchoApp(object):
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)
return ["ECHO"]
vcsserver: added stream EchoApp for testing
r248 class EchoAppStream(object):
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():
for _ in xrange(1000000):
yield "ECHO"
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)