From a87c096d69d8ac0ed693fa07d8bc83e5006875ca Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Thu, 27 Oct 2011 10:47:59 +0200 Subject: [PATCH] Allow plugins to take over a subdirectory of the HTTP server. --- src/httpserver.py | 8 +++++--- src/version.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/httpserver.py b/src/httpserver.py index 9d5f35fb8..3eb3851ed 100644 --- a/src/httpserver.py +++ b/src/httpserver.py @@ -57,9 +57,11 @@ class RealSupyHTTPServer(HTTPServer): running = False def hook(self, subdir, callback): if subdir in self.callbacks: - raise KeyError('This subdir is already hooked.') - else: - self.callbacks[subdir] = callback + log.warning(('The HTTP subdirectory `%s` was already hooked but ' + 'has been claimed by another plugin (or maybe you ' + 'reloaded the plugin and it didn\'t properly unhook. ' + 'Forced unhook.') % subdir) + self.callbacks[subdir] = callback def unhook(self, subdir): callback = self.callbacks.pop(subdir) # May raise a KeyError. We don't care. callback.doUnhook(self) diff --git a/src/version.py b/src/version.py index f077fd43f..6e7231bf4 100644 --- a/src/version.py +++ b/src/version.py @@ -1,3 +1,3 @@ """stick the various versioning attributes in here, so we only have to change them once.""" -version = '0.83.4.1+limnoria (2011-10-27T10:47:25+0200)' +version = '0.83.4.1+limnoria (2011-10-27T10:47:59+0200)'