Files
@ 23a9ea4219dc
Branch filter:
Location: majic-ansible-roles/roles/wsgi_website/tests/data/python/wsgi/testapp.py - annotation
23a9ea4219dc
1.0 KiB
text/x-python
MAR-113: Added option for specifying relay port to mail_forwarder:
- Introduced new option "smtp_relay_host_port".
- Updated the test playbook and tests to make sure new functionality works as
expected.
- Update role reference documentation.
- Updated usage instructions.
- Introduced new option "smtp_relay_host_port".
- Updated the test playbook and tests to make sure new functionality works as
expected.
- Update role reference documentation.
- Updated usage instructions.
b68d19ad38a3 b68d19ad38a3 b68d19ad38a3 b68d19ad38a3 b68d19ad38a3 b68d19ad38a3 b68d19ad38a3 b68d19ad38a3 b68d19ad38a3 b68d19ad38a3 b68d19ad38a3 998aab91d6b4 b68d19ad38a3 b68d19ad38a3 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 b68d19ad38a3 b68d19ad38a3 b68d19ad38a3 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 998aab91d6b4 b68d19ad38a3 b68d19ad38a3 b68d19ad38a3 b68d19ad38a3 b68d19ad38a3 b68d19ad38a3 | #!/usr/bin/env python
import os
def application(environ, start_response):
status = '200 OK'
template = """<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{host}</title>
</head>
<body>
<p>This is the WSGI application at {host}.</p>
<p>Requested URL was: {scheme}://{host}{script}{path}
<p>MY_ENV_VAR: {my_env_var}</p>
<p>Accept-Encoding: {accept_encoding}</p>
</body>
</html>
"""
parameters = {}
parameters['host'] = environ['HTTP_HOST']
parameters['scheme'] = environ['wsgi.url_scheme']
parameters['script'] = environ['SCRIPT_NAME']
parameters['path'] = environ['PATH_INFO']
parameters['my_env_var'] = os.environ.get('MY_ENV_VAR', None)
parameters['accept_encoding'] = environ.get('HTTP_ACCEPT_ENCODING')
output = template.format(**parameters)
response_headers = [('Content-type', 'text/html'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
|