changeset 1176:ba4ce38b90a3

Merge with TAH.
author Bryan O'Sullivan <bos@serpentine.com>
date Wed, 31 Aug 2005 10:54:46 -0700
parents 7e909ceeb36a (current diff) 9d9f4973c76a (diff)
children 862f53c1d0f9
files
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb.py	Wed Aug 31 10:54:00 2005 -0700
+++ b/mercurial/hgweb.py	Wed Aug 31 10:54:46 2005 -0700
@@ -6,7 +6,7 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-import os, cgi, time, re, socket, sys, zlib
+import os, cgi, time, re, socket, sys, zlib, errno
 import mdiff
 from hg import *
 from ui import *
@@ -77,8 +77,8 @@
                     self.out.write(thing)
                 except TypeError:
                     self.out.write(str(thing))
-                except socket.error, x:
-                    if x[0] != errno.ECONNRESET:
+                except socket.error, inst:
+                    if inst[0] != errno.ECONNRESET:
                         raise
 
     def header(self, headers=[('Content-type','text/html')]):
@@ -178,8 +178,7 @@
             self.repo = repo
 
         self.mtime = -1
-        self.reponame = name or self.repo.ui.config("web", "name",
-                                                    self.repo.root)
+        self.reponame = name
         self.archives = 'zip', 'gz', 'bz2'
 
     def refresh(self):
@@ -730,6 +729,9 @@
         if "?" in uri:
             uri = uri.split("?")[0]
         url = "http://%s%s%s" % (req.env["SERVER_NAME"], port, uri)
+        if not self.reponame:
+            self.reponame = (self.repo.ui.config("web", "name")
+                             or uri.strip('/') or self.repo.root)
 
         self.t = templater(m, common_filters,
                            {"url": url,
@@ -867,7 +869,7 @@
             try:
                 self.do_hgweb()
             except socket.error, inst:
-                if inst.args[0] != 32:
+                if inst[0] != errno.EPIPE:
                     raise
 
         def do_GET(self):