Files
@ c43415e60f2f
Branch filter:
Location: majic-ansible-roles/testsite/playbooks/roles/wsgihello2/files/hello.wsgi - annotation
c43415e60f2f
1.0 KiB
text/plain
MAR-123: Updated ldap_server test_user_supplied_entries to be robust to ordering changes.
2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e 2b3af82bc50e | #!/usr/bin/env python
import os
import ipcalc
def application(environ, start_response):
status = '200 OK'
template = """<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{title}</title>
</head>
<body>
<h1>Hello, world!</h1>
<p>I am website {title}</p>
<p>Accept-Encoding header was set to {acceptencoding}</p>
<p>Available IP range for subnet {subnet} is from {subnet_first} to {subnet_last}</p>
</body>
</html>
"""
subnet = ipcalc.Network('10.128.128.0/24')
output = template.format(title=os.environ.get("WEBSITE_NAME", "that nobody set a name for :("),
acceptencoding=environ.get("HTTP_ACCEPT_ENCODING"),
subnet=str(subnet),
subnet_first=subnet.host_first(),
subnet_last=subnet.host_last())
response_headers = [('Content-type', 'text/html'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
|