changeset 2394:a8f1049d1d2d

hgweb: fix errors and warnings found by pychecker - fix missing import - use type_ instead of type - remove unused variable
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 04 Jun 2006 12:19:51 +0200
parents 5083cba2a777
children 8ed45fb1053a 8d44649df03b
files mercurial/hgweb/hgweb_mod.py mercurial/hgweb/request.py
diffstat 2 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -591,7 +591,6 @@ class hgweb(object):
         count = cl.count()
         start = max(0, count - self.maxchanges)
         end = min(count, start + self.maxchanges)
-        pos = end - 1
 
         yield self.t("summary",
                  desc = self.repo.ui.config("web", "description", "unknown"),
@@ -629,10 +628,10 @@ class hgweb(object):
         'zip': ('application/zip', 'zip', '.zip', None),
         }
 
-    def archive(self, req, cnode, type):
+    def archive(self, req, cnode, type_):
         reponame = re.sub(r"\W+", "-", os.path.basename(self.reponame))
         name = "%s-%s" % (reponame, short(cnode))
-        mimetype, artype, extension, encoding = self.archive_specs[type]
+        mimetype, artype, extension, encoding = self.archive_specs[type_]
         headers = [('Content-type', mimetype),
                    ('Content-disposition', 'attachment; filename=%s%s' %
                     (name, extension))]
@@ -649,7 +648,7 @@ class hgweb(object):
         def clean(path):
             p = util.normpath(path)
             if p[:2] == "..":
-                raise "suspicious path"
+                raise Exception("suspicious path")
             return p
 
         def header(**map):
@@ -804,11 +803,11 @@ class hgweb(object):
 
         elif cmd == 'archive':
             changeset = self.repo.lookup(req.form['node'][0])
-            type = req.form['type'][0]
+            type_ = req.form['type'][0]
             allowed = self.repo.ui.config("web", "allow_archive", "").split()
-            if (type in self.archives and (type in allowed or
-                self.repo.ui.configbool("web", "allow" + type, False))):
-                self.archive(req, changeset, type)
+            if (type_ in self.archives and (type_ in allowed or
+                self.repo.ui.configbool("web", "allow" + type_, False))):
+                self.archive(req, changeset, type_)
                 return
 
             req.write(self.t("error"))
--- a/mercurial/hgweb/request.py
+++ b/mercurial/hgweb/request.py
@@ -7,7 +7,7 @@
 # of the GNU General Public License, incorporated herein by reference.
 
 from mercurial.demandload import demandload
-demandload(globals(), "socket sys cgi os")
+demandload(globals(), "socket sys cgi os errno")
 from mercurial.i18n import gettext as _
 
 class hgrequest(object):