# HG changeset patch # User Steve Losh # Date 1276446664 14400 # Node ID 69015b8a626f84017baee96593cd80b674bd6307 # Parent 1262a21153ac9b5b3bf7ea6118e496e773fe0f27 web: add a site_root option for deployments diff -r 1262a21153ac -r 69015b8a626f contrib/deploy/wsgi.py --- 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 ' +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) diff -r 1262a21153ac -r 69015b8a626f review/web_ui.py --- 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//', 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 ')