comparison mercurial/hgweb/webcommands.py @ 6669:782dbbdfb1d7

fix traceback in hgweb when URL doesn't end in one of the archive specs If the last n charecters of the URL doesn't match an entry in archive_specs req.form never has a key 'type'. When achive() looks up 'type' in the form dict it causes a traceback rather than printing an error message.
author Ali Saidi <saidi@eecs.umich.edu>
date Fri, 13 Jun 2008 12:33:40 +0200
parents 2c370f08c486
children be55b1a6d4b1 2ff0829bdae5
comparison
equal deleted inserted replaced
6662:22c303a514f8 6669:782dbbdfb1d7
107 107
108 def filelog(web, req, tmpl): 108 def filelog(web, req, tmpl):
109 return web.filelog(tmpl, web.filectx(req)) 109 return web.filelog(tmpl, web.filectx(req))
110 110
111 def archive(web, req, tmpl): 111 def archive(web, req, tmpl):
112 type_ = req.form['type'][0] 112 type_ = req.form.get('type', [None])[0]
113 allowed = web.configlist("web", "allow_archive") 113 allowed = web.configlist("web", "allow_archive")
114 if (type_ in web.archives and (type_ in allowed or 114 if (type_ in web.archives and (type_ in allowed or
115 web.configbool("web", "allow" + type_, False))): 115 web.configbool("web", "allow" + type_, False))):
116 web.archive(tmpl, req, req.form['node'][0], type_) 116 web.archive(tmpl, req, req.form['node'][0], type_)
117 return [] 117 return []