b443b42afe6f issue-90

Convert unicode to ascii for mercurial API.

Mercurial API can't work with python's Unicode objects.
Details http://mercurial.selenic.com/wiki/EncodingStrategy#Unicode_strings
[view raw] [browse files]
author Alexander Stepanenko <olexander314@gmail.com>
date Mon, 15 Dec 2014 02:06:13 +0300
parents 73d048325dfd
children af974f8d1eec
branches/tags issue-90
files review/web.py

Changes

--- a/review/web.py	Fri Dec 12 10:36:19 2014 +0100
+++ b/review/web.py	Mon Dec 15 02:06:13 2014 +0300
@@ -173,6 +173,7 @@
 
 @app.route('/changeset/<revhash>/', methods=['GET', 'POST'])
 def changeset(revhash):
+    revhash = revhash.encode('ascii')
     if request.method == 'POST':
         signoff = request.form.get('signoff', None)
         if signoff and not app.read_only:
@@ -197,6 +198,7 @@
 def patch(revhash):
     result = StringIO.StringIO()
     try:
+        revhash = revhash.encode('ascii')
         diff_opts = _patch.diffopts(app.ui, {'git': True})
         cmdutil.export(g.datastore.target, [revhash], fp=result, opts=diff_opts)
     except error.RepoLookupError: