mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-18 08:02:49 +01:00
Allow plugins to take over a subdirectory of the HTTP server.
This commit is contained in:
parent
51e02849ad
commit
a87c096d69
@ -57,9 +57,11 @@ class RealSupyHTTPServer(HTTPServer):
|
|||||||
running = False
|
running = False
|
||||||
def hook(self, subdir, callback):
|
def hook(self, subdir, callback):
|
||||||
if subdir in self.callbacks:
|
if subdir in self.callbacks:
|
||||||
raise KeyError('This subdir is already hooked.')
|
log.warning(('The HTTP subdirectory `%s` was already hooked but '
|
||||||
else:
|
'has been claimed by another plugin (or maybe you '
|
||||||
self.callbacks[subdir] = callback
|
'reloaded the plugin and it didn\'t properly unhook. '
|
||||||
|
'Forced unhook.') % subdir)
|
||||||
|
self.callbacks[subdir] = callback
|
||||||
def unhook(self, subdir):
|
def unhook(self, subdir):
|
||||||
callback = self.callbacks.pop(subdir) # May raise a KeyError. We don't care.
|
callback = self.callbacks.pop(subdir) # May raise a KeyError. We don't care.
|
||||||
callback.doUnhook(self)
|
callback.doUnhook(self)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
"""stick the various versioning attributes in here, so we only have to change
|
"""stick the various versioning attributes in here, so we only have to change
|
||||||
them once."""
|
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)'
|
||||||
|
Loading…
Reference in New Issue
Block a user