httpserver: add method 'doHook' to callbacks.

This commit is contained in:
Valentin Lorentz 2014-01-02 17:20:15 +00:00
parent 9457f4dbe7
commit 38d78a4213
1 changed files with 4 additions and 0 deletions

View File

@ -184,6 +184,7 @@ class RealSupyHTTPServer(HTTPServer):
'reloaded the plugin and it didn\'t properly unhook. '
'Forced unhook.') % subdir)
self.callbacks[subdir] = callback
callback.doHook(self, subdir)
def unhook(self, subdir):
callback = self.callbacks.pop(subdir) # May raise a KeyError. We don't care.
callback.doUnhook(self)
@ -283,6 +284,9 @@ class SupyHTTPServerCallback(object):
doPost = doHead = doGet
def doHook(self, handler, subdir):
"""Method called when hooking this callback."""
pass
def doUnhook(self, handler):
"""Method called when unhooking this callback."""
pass