diff --git a/pages/bash.mako b/pages/bash.mako deleted file mode 100644 index 8f2724f..0000000 --- a/pages/bash.mako +++ /dev/null @@ -1,15 +0,0 @@ -<%! - from random import choice - bashes = [ - "Now 20% cooler!", - "I make tools and tool accessories." - ] -%>\ -<%def name="get_bash()">${choice(bashes)}\ -<%include file="/support/header.mako" args="environ=environ, title='Bash'"/> -
    - % for bash in bashes: -
  1. ${bash}
  2. - % endfor -
-<%include file="/support/footer.mako" args="environ=environ"/> diff --git a/pages/support/footer.mako b/pages/support/footer.mako index 52daa9b..e93f37f 100644 --- a/pages/support/footer.mako +++ b/pages/support/footer.mako @@ -1,5 +1,4 @@ <%page args="environ"/>\ -<%namespace name="bash" file="/bash.mako" import="get_bash"/>\ <%! from os import path %>\ @@ -20,8 +19,7 @@ Contact • \ View Source • \ Background • \ - Valid XHTML 1.0 Strict
- "${get_bash()}" + Valid XHTML 1.0 Strict

diff --git a/toolserver/misc.py b/toolserver/misc.py index 9f65e65..d65903f 100644 --- a/toolserver/misc.py +++ b/toolserver/misc.py @@ -7,11 +7,20 @@ from earwigbot.bot import Bot import oursql class Query(object): - def __init__(self, environ): + def __init__(self, environ, method="GET"): self.query = {} - parsed = parse_qs(environ["QUERY_STRING"]) + if method == "GET": + parsed = parse_qs(environ["QUERY_STRING"]) + elif method == "POST": + size = environ.get("CONTENT_LENGTH", 0) + parsed = parse_qs(environ["wsgi.input"].read(size)) + else: + parsed = {} for key, value in parsed.iteritems(): - self.query[key] = value[-1].decode("utf8") + try: + self.query[key] = value[-1].decode("utf8") + except UnicodeDecodeError: + pass def __getattr__(self, key): try: diff --git a/toolserver/settings.py b/toolserver/settings.py index 4338334..07b1be7 100644 --- a/toolserver/settings.py +++ b/toolserver/settings.py @@ -6,7 +6,7 @@ from .sites import get_sites def main(context, environ, headers): cookies = parse_cookies(context, environ) - query = Query(environ) + query = Query(environ, method="POST") if query.action == "set": if query.lang: