diff mercurial/hgweb/webutil.py @ 34404:407ebe7a9b93

hgweb: use parsebool for parsing diff query string options Differential Revision: https://phab.mercurial-scm.org/D875
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 01 Oct 2017 12:29:33 +0100
parents f6492f482c60
children 3caec3c032c8
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py	Sun Oct 01 14:02:47 2017 +0100
+++ b/mercurial/hgweb/webutil.py	Sun Oct 01 12:29:33 2017 +0100
@@ -177,12 +177,8 @@
     for k in ('ignorews', 'ignorewsamount', 'ignorewseol', 'ignoreblanklines'):
         v = req.form.get(k, [None])[0]
         if v is not None:
-            try:
-                v = bool(int(v))
-            except ValueError:
-                v = True
-
-            setattr(diffopts, k, v)
+            v = util.parsebool(v)
+            setattr(diffopts, k, v if v is not None else True)
 
     return diffopts