Remove unhandled_okay from kwargs if it's there before passing to functions.
authorChristopher Allan Webber <cwebber@dustycloud.org>
Wed, 10 Apr 2013 22:42:29 +0000 (17:42 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Wed, 10 Apr 2013 22:42:29 +0000 (17:42 -0500)
mediagoblin/tools/pluginapi.py

index 2c0394aaa6ecaa68e4c9c2357740cfa855e8ea51..283350a8eb0289207363ba9a419e152ddaf9b3d7 100644 (file)
@@ -307,13 +307,15 @@ def callable_runone(hookname, *args, **kwargs):
     """
     callables = PluginManager().get_hook_callables(hookname)
 
+    unhandled_okay = kwargs.pop("unhandled_okay", False)
+
     for callable in callables:
         try:
             return callable(*args, **kwargs)
         except CantHandleIt:
             continue
 
-    if kwargs.get("unhandled_okay", False) is False:
+    if unhandled_okay is False:
         raise UnhandledCallable(
             "No hooks registered capable of handling '%s'" % hookname)