Use ConfigParser only in hgwebdir.__init__()
authorThomas Arendsen Hein <thomas@intevation.de>
Mon, 29 Aug 2005 07:28:39 +0200
changeset 1141 033c968d7c66
parent 1140 04d52b446e5e
child 1142 74d184a40a2e
Use ConfigParser only in hgwebdir.__init__()
mercurial/hgweb.py
--- a/mercurial/hgweb.py	Mon Aug 29 07:19:02 2005 +0200
+++ b/mercurial/hgweb.py	Mon Aug 29 07:28:39 2005 +0200
@@ -922,8 +922,10 @@
 # This is a stopgap
 class hgwebdir:
     def __init__(self, config):
-        self.cp = ConfigParser.SafeConfigParser()
-        self.cp.read(config)
+        cp = ConfigParser.SafeConfigParser()
+        cp.read(config)
+        self.repos = cp.items("paths")
+        self.repos.sort()
 
     def run(self):
         def header(**map):
@@ -939,9 +941,7 @@
 
         def entries(**map):
             parity = 0
-            repos = self.cp.items("paths")
-            repos.sort()
-            for name, path in repos:
+            for name, path in self.repos:
                 u = ui()
                 u.readconfig(file(os.path.join(path, '.hg', 'hgrc')))
                 get = u.config
@@ -968,8 +968,8 @@
         virtual = virtual.strip('/')
 
         if len(virtual):
-            if self.cp.has_option("paths", virtual):
-                real = self.cp.get("paths", virtual)
+            real = dict(self.repos).get(virtual)
+            if real:
                 h = hgweb(real)
                 h.run()
                 return