Show More
@@ -1,34 +1,34 b'' | |||
|
1 | 1 | """ |
|
2 | 2 | Implementation of :class:`EchoApp`. |
|
3 | 3 | |
|
4 | 4 | This WSGI application will just echo back the data which it recieves. |
|
5 | 5 | """ |
|
6 | 6 | |
|
7 | 7 | import logging |
|
8 | 8 | |
|
9 | 9 | |
|
10 | 10 | log = logging.getLogger(__name__) |
|
11 | 11 | |
|
12 | 12 | |
|
13 | 13 | class EchoApp(object): |
|
14 | 14 | |
|
15 | 15 | def __init__(self, repo_path, repo_name, config): |
|
16 | 16 | self._repo_path = repo_path |
|
17 | 17 | log.info("EchoApp initialized for %s", repo_path) |
|
18 | 18 | |
|
19 | 19 | def __call__(self, environ, start_response): |
|
20 | 20 | log.debug("EchoApp called for %s", self._repo_path) |
|
21 | 21 | log.debug("Content-Length: %s", environ.get('CONTENT_LENGTH')) |
|
22 | 22 | environ['wsgi.input'].read() |
|
23 | 23 | status = '200 OK' |
|
24 | headers = [] | |
|
24 | headers = [('Content-Type', 'text/plain')] | |
|
25 | 25 | start_response(status, headers) |
|
26 | 26 | return ["ECHO"] |
|
27 | 27 | |
|
28 | 28 | |
|
29 | 29 | def create_app(): |
|
30 | 30 | """ |
|
31 | 31 | Allows to run this app directly in a WSGI server. |
|
32 | 32 | """ |
|
33 | 33 | stub_config = {} |
|
34 | 34 | return EchoApp('stub_path', 'stub_name', stub_config) |
General Comments 0
You need to be logged in to leave comments.
Login now