#!/usr/bin/python

import os

from string import Template

print "Content-Type: text/html"
print

tmpl = Template(file('index.html.tmpl').read())
target = os.environ['REQUEST_URI']
if target.startswith('/_'):
    target = '/' + target.lstrip('/').lstrip('_')
    target = target.replace('%7C', '#', 1)
else:
    target = '/r/'
content = tmpl.substitute(target_url=target)
print content

#!/usr/bin/python

import os
from urllib import unquote

from string import Template

print "Content-Type: text/html"
print

tmpl = Template(file('index.html.tmpl').read())
target = os.environ['REQUEST_URI']
if target.startswith('/_'):
    target = '/' + target.lstrip('/').lstrip('_')
    target = unquote(target)
    target = target.replace('|', '#', 1)
else:
    target = '/r/'
content = tmpl.substitute(target_url=target)
print content

Fix URL fragment management on Firefox
Fix URL fragment management on Firefox

Close Bug: 13

Change-Id: If3e3182e670b4c498043a58f2b5a82cb87560722
