New macros needed for wikized EditPage
authorBernie Innocenti <bernie@codewiz.org>
Wed, 8 Apr 2009 19:41:11 +0000 (21:41 +0200)
committerBernie Innocenti <bernie@codewiz.org>
Wed, 8 Apr 2009 19:41:11 +0000 (21:41 +0200)
macros/CgiVar.py [new file with mode: 0755]
macros/HttpPost.py [new file with mode: 0755]

diff --git a/macros/CgiVar.py b/macros/CgiVar.py
new file mode 100755 (executable)
index 0000000..9199514
--- /dev/null
@@ -0,0 +1,7 @@
+def _macro_CgiVar(argv):
+    return {
+        'REMOTE_USER': remote_user(),
+        'REMOTE_HOST': get_hostname(remote_host()),
+        'REMOTE_ADDR': remote_host(),
+        'QUERY_STRING': relative_url(query_string()),
+    }[argv[1]]
diff --git a/macros/HttpPost.py b/macros/HttpPost.py
new file mode 100755 (executable)
index 0000000..ce61f79
--- /dev/null
@@ -0,0 +1,6 @@
+def _macro_HttpPost(argv):
+    if argv[1] in form:
+        return form[argv[1]].value
+    elif len(argv) > 2:
+        return argv[2] # default value
+    return ''