check for KeyError (fix #311)

This commit is contained in:
Yann Leboulanger 2005-05-22 10:10:41 +00:00
parent 98248632b7
commit 6f6f45d07b
1 changed files with 2 additions and 0 deletions

View File

@ -182,6 +182,8 @@ class Dispatcher(PlugIn):
""" Unregister handler. "typ" and "ns" must be specified exactly the same as with registering.""" """ Unregister handler. "typ" and "ns" must be specified exactly the same as with registering."""
if not xmlns: xmlns=self._owner.defaultNamespace if not xmlns: xmlns=self._owner.defaultNamespace
if not typ and not ns: typ='default' if not typ and not ns: typ='default'
if not self.handlers[xmlns].has_key(name): return
if not self.handlers[xmlns][name].has_key(typ+ns): return
for pack in self.handlers[xmlns][name][typ+ns]: for pack in self.handlers[xmlns][name][typ+ns]:
if handler==pack['func']: break if handler==pack['func']: break
else: pack=None else: pack=None