diff mercurial/hgweb/hgweb_mod.py @ 5598:d534ba1c4eb4

separate the wire protocol commands from the user interface commands
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Mon, 03 Dec 2007 12:27:11 +0100
parents e7f99a3ed008
children 3de66c2a9734
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py	Mon Dec 03 12:06:21 2007 +0100
+++ b/mercurial/hgweb/hgweb_mod.py	Mon Dec 03 12:27:11 2007 +0100
@@ -12,7 +12,7 @@
 from mercurial import revlog, templater
 from common import ErrorResponse, get_mtime, style_map, paritygen
 from request import wsgirequest
-import webcommands
+import webcommands, protocol
 
 shortcuts = {
     'cl': [('cmd', ['changelog']), ('rev', None)],
@@ -177,7 +177,7 @@
                 cmd = cmd[style+1:]
 
             # avoid accepting e.g. style parameter as command
-            if hasattr(webcommands, cmd):
+            if hasattr(webcommands, cmd) or hasattr(protocol, cmd):
                 req.form['cmd'] = [cmd]
 
             if args and args[0]:
@@ -276,7 +276,10 @@
             cmd = req.form['cmd'][0]
 
             try:
-                method = getattr(webcommands, cmd)
+                if hasattr(protocol, cmd):
+                    method = getattr(protocol, cmd)
+                else:
+                    method = getattr(webcommands, cmd)
                 method(self, req)
             except revlog.LookupError, err:
                 req.respond(404, self.t(