Simplify page editor
[wiki.git] / sys / macros / CgiVar.py
1 #acl bernie:read,write All:read
2
3 #FIXME: couldn't we just return any env variable?
4 #       Would there be any security issues?
5 def _macro_CgiVar(*args, **kvargs):
6     if args[1].startswith('HTTP_'):
7         return os.environ.get(args[1], '')
8     return {
9         'SCRIPT_NAME': script_name(),
10         'REMOTE_USER': remote_user(),
11         'REMOTE_HOST': get_hostname(remote_host()),
12         'REMOTE_ADDR': remote_host(),
13         'QUERY_STRING': query_string(),
14     }[args[1]]