[PATCH] hgweb_mod: fix key error on file display

Dirkjan Ochtman dirkjan at ochtman.nl
Sun Jan 20 02:50:07 CST 2008


Christian Ebert wrote:
> # HG changeset patch
> # User Christian Ebert <blacktrash at gmx.net>
> # Date 1200798507 -3600
> # Node ID 6e58ced7644ab291ca0771101f0c775059462820
> # Parent  b9a830fa10f6d8d2407107530b5306124c8fc181
> hgweb_mod: fix key error on file display
> 
> diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
> --- a/mercurial/hgweb/hgweb_mod.py
> +++ b/mercurial/hgweb/hgweb_mod.py
> @@ -212,7 +212,8 @@
>                      req.form['cmd'] = [tmpl.cache['default']]
>                      cmd = req.form['cmd'][0]
>  
> -                if cmd == 'file' and 'raw' in req.form['style']:
> +                if (cmd == 'file' and
> +                    req.form.has_key('style') and 'raw' in req.form['style']):
>                      webcommands.rawfile(self, req, tmpl)
>                  else:
>                      getattr(webcommands, cmd)(self, req, tmpl)
> 

Argh, that's stupid. Could you also write a testcase for that? I don't 
know why, but it wasn't caught by any of the current tests...

Cheers,

Dirkjan



More information about the Mercurial-devel mailing list