Mercurial > hg
comparison mercurial/hgweb/hgweb_mod.py @ 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 | c52b7176af94 |
children | ca639faa38a2 7843528a7922 |
comparison
equal
deleted
inserted
replaced
4242:e1cdf5f6386e | 4243:3f2e334937ce |
---|---|
804 "motd": motd, | 804 "motd": motd, |
805 "rawfileheader": rawfileheader, | 805 "rawfileheader": rawfileheader, |
806 "sessionvars": sessionvars | 806 "sessionvars": sessionvars |
807 }) | 807 }) |
808 | 808 |
809 if not req.form.has_key('cmd'): | 809 try: |
810 req.form['cmd'] = [self.t.cache['default']] | 810 if not req.form.has_key('cmd'): |
811 | 811 req.form['cmd'] = [self.t.cache['default']] |
812 cmd = req.form['cmd'][0] | 812 |
813 | 813 cmd = req.form['cmd'][0] |
814 method = getattr(self, 'do_' + cmd, None) | 814 |
815 if method: | 815 method = getattr(self, 'do_' + cmd, None) |
816 try: | 816 if method: |
817 method(req) | 817 try: |
818 except (hg.RepoError, revlog.RevlogError), inst: | 818 method(req) |
819 req.write(self.t("error", error=str(inst))) | 819 except (hg.RepoError, revlog.RevlogError), inst: |
820 else: | 820 req.write(self.t("error", error=str(inst))) |
821 req.write(self.t("error", error='No such method: ' + cmd)) | 821 else: |
822 req.write(self.t("error", error='No such method: ' + cmd)) | |
823 finally: | |
824 self.t = None | |
822 | 825 |
823 def changectx(self, req): | 826 def changectx(self, req): |
824 if req.form.has_key('node'): | 827 if req.form.has_key('node'): |
825 changeid = req.form['node'][0] | 828 changeid = req.form['node'][0] |
826 elif req.form.has_key('manifest'): | 829 elif req.form.has_key('manifest'): |