[PATCH] hgweb_mod: fix key error on file display

Bryan O'Sullivan bos at serpentine.com
Sat Jan 19 23:24:58 CST 2008


Christian Ebert wrote:

> -                if cmd == 'file' and 'raw' in req.form['style']:
> +                if (cmd == 'file' and
> +                    req.form.has_key('style') and 'raw' in req.form['style']):

Prefer a smaller modification to the original:

  'raw' in req.form.get('style', [])

Also, the has_key method is a holdover from Python 1.x.  "a in b" is
more idiomatic.

	<b


More information about the Mercurial-devel mailing list