--- a/contrib/deploy/wsgi.py Sun Jun 13 12:11:22 2010 -0400
+++ b/contrib/deploy/wsgi.py Sun Jun 13 12:31:04 2010 -0400
@@ -10,6 +10,7 @@
READ_ONLY = True
ALLOW_ANON_COMMENTS = False
ANON_USER = 'Anonymous <anonymous@example.com>'
+SITE_ROOT = 'http://yoursite.com/optional/path'
from mercurial import hg, ui
from web_ui import app
@@ -21,6 +22,7 @@
app.read_only = READ_ONLY
app.allow_anon = ALLOW_ANON_COMMENTS
+app.site_root = SITE_ROOT.rstrip('/')
app.debug = False
app.datastore = ReviewDatastore(_ui, repo)
--- a/review/web_ui.py Sun Jun 13 12:11:22 2010 -0400
+++ b/review/web_ui.py Sun Jun 13 12:31:04 2010 -0400
@@ -85,7 +85,7 @@
rcset = app.datastore[revhash]
rcset.add_signoff(body, signoff, force=True)
- return redirect("/changeset/%s/" % revhash)
+ return redirect("%s/changeset/%s/" % (app.site_root, revhash))
def _handle_comment(revhash):
filename = request.form.get('filename', '')
@@ -98,7 +98,7 @@
rcset = app.datastore[revhash]
rcset.add_comment(body, filename, lines)
- return redirect("/changeset/%s/" % revhash)
+ return redirect("%s/changeset/%s/" % (app.site_root, revhash))
@app.route('/changeset/<revhash>/', methods=['GET', 'POST'])
def changeset(revhash):
@@ -126,14 +126,14 @@
if not app.read_only:
path = request.form['path']
commands.pull(app.datastore.repo.ui, app.datastore.repo, path, update=True)
- return redirect('/')
+ return redirect('%s/' % app.site_root)
@app.route('/push/', methods=['POST'])
def push():
if not app.read_only:
path = request.form['path']
commands.push(app.datastore.repo.ui, app.datastore.repo, path)
- return redirect('/')
+ return redirect('%s/' % app.site_root)
def load_interface(ui, repo, read_only=False, allow_anon=False,
@@ -145,6 +145,7 @@
app.read_only = read_only
app.debug = ui.debugflag
app.allow_anon = allow_anon
+ app.site_root = ''
if app.allow_anon:
ui.setconfig('ui', 'username', 'Anonymous <anonymous@example.com>')