changeset 1141:033c968d7c66

Use ConfigParser only in hgwebdir.__init__()
author Thomas Arendsen Hein <thomas@intevation.de>
date Mon, 29 Aug 2005 07:28:39 +0200
parents 04d52b446e5e
children 74d184a40a2e
files mercurial/hgweb.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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