(0.9.2compat) fix webcommand monkey patches, and adapt to most recent changes 0.9.2compat
authorChristian Ebert <blacktrash@gmx.net>
Sun, 30 Mar 2008 17:13:02 +0200
branch0.9.2compat
changeset 433 d830cdde0ddb
parent 432 140fe33eacf3
child 434 0884558504a3
(0.9.2compat) fix webcommand monkey patches, and adapt to most recent changes
hgkw/keyword.py
--- a/hgkw/keyword.py	Sun Mar 30 17:04:37 2008 +0200
+++ b/hgkw/keyword.py	Sun Mar 30 17:13:02 2008 +0200
@@ -167,16 +167,24 @@
 
 try:
     from mercurial.hgweb import webcommands
+    _webcommands_changeset = webcommands.changeset
+    _webcommands_filediff = webcommands.filediff
 
     def _kwweb_changeset(web, req, tmpl):
         '''Wraps webcommands.changeset turning off keyword expansion.'''
         kwtools['templater'].matcher = util.never
-        return web.changeset(tmpl, web.changectx(req))
+        try:
+            return _webcommands_changeset(web, req, tmpl)
+        except TypeError:
+            return _webcommands_changeset(tmpl, web.changectx(req))
 
     def _kwweb_filediff(web, req, tmpl):
         '''Wraps webcommands.filediff turning off keyword expansion.'''
         kwtools['templater'].matcher = util.never
-        return web.filediff(tmpl, web.filectx(req))
+        try:
+            return _webcommands_filediff(web, req, tmpl)
+        except TypeError:
+            return _webcommands_filediff(tmpl, web.filectx(req))
 
     webcommands.changeset = webcommands.rev = _kwweb_changeset
     webcommands.filediff = webcommands.diff = _kwweb_filediff