[PATCH] hgweb: fix hgweb_mod as well as hgwebdir_mod

Augie Fackler durin42 at gmail.com
Sun Oct 10 10:45:49 CDT 2010


# HG changeset patch
# User Augie Fackler <durin42 at gmail.com>
# Date 1286725364 18000
# Node ID 9da1e6ccea99457fd6f4e76b944b53c1fd5b4f32
# Parent  94e7bd38d9a31226ec1bef394f16da0e8d86f8aa
hgweb: fix hgweb_mod as well as hgwebdir_mod

diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -28,7 +28,7 @@
             if baseui:
                 u = baseui.copy()
             else:
-                u = ui.ui()
+                u = webutil.wsgiui()
             self.repo = hg.repository(u, repo)
         else:
             self.repo = repo
diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -41,11 +41,6 @@
             repos.append((name, path))
     return repos
 
-class wsgiui(ui.ui):
-    # default termwidth breaks under mod_wsgi
-    def termwidth(self):
-        return 80
-
 class hgwebdir(object):
     refreshinterval = 20
 
@@ -63,7 +58,7 @@
         if self.baseui:
             u = self.baseui.copy()
         else:
-            u = wsgiui()
+            u = webutil.wsgiui()
             u.setconfig('ui', 'report_untrusted', 'off')
             u.setconfig('ui', 'interactive', 'off')
 
diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -7,7 +7,7 @@
 # GNU General Public License version 2 or any later version.
 
 import os, copy
-from mercurial import match, patch, util, error
+from mercurial import match, patch, util, error, ui
 from mercurial.node import hex, nullid
 
 def up(p):
@@ -219,3 +219,8 @@
         for key, value in self.vars.iteritems():
             yield {'name': key, 'value': str(value), 'separator': separator}
             separator = '&'
+
+class wsgiui(ui.ui):
+    # default termwidth breaks under mod_wsgi
+    def termwidth(self):
+        return 80


More information about the Mercurial-devel mailing list