changeset 4243:3f2e334937ce

hgweb: break templater -> templater circular reference The problem were some functions passed in the "defaults" argument during the templater creation which use "self.t" directly. This creates the cycle: hgweb object -> templater object -> defaults dict -> footer function -> hgweb object Instead of completely avoding the cycle, we break it after using the templater.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 19 Mar 2007 19:07:35 -0300
parents e1cdf5f6386e
children a80502f47552
files mercurial/hgweb/hgweb_mod.py
diffstat 1 files changed, 14 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py	Sun Mar 18 20:39:25 2007 +0100
+++ b/mercurial/hgweb/hgweb_mod.py	Mon Mar 19 19:07:35 2007 -0300
@@ -806,19 +806,22 @@
                                                "sessionvars": sessionvars
                                                })
 
-        if not req.form.has_key('cmd'):
-            req.form['cmd'] = [self.t.cache['default']]
+        try:
+            if not req.form.has_key('cmd'):
+                req.form['cmd'] = [self.t.cache['default']]
 
-        cmd = req.form['cmd'][0]
+            cmd = req.form['cmd'][0]
 
-        method = getattr(self, 'do_' + cmd, None)
-        if method:
-            try:
-                method(req)
-            except (hg.RepoError, revlog.RevlogError), inst:
-                req.write(self.t("error", error=str(inst)))
-        else:
-            req.write(self.t("error", error='No such method: ' + cmd))
+            method = getattr(self, 'do_' + cmd, None)
+            if method:
+                try:
+                    method(req)
+                except (hg.RepoError, revlog.RevlogError), inst:
+                    req.write(self.t("error", error=str(inst)))
+            else:
+                req.write(self.t("error", error='No such method: ' + cmd))
+        finally:
+            self.t = None
 
     def changectx(self, req):
         if req.form.has_key('node'):