1 # XXX: All monkey patches should be sent upstream and eventually removed.
6 """Patch the function named attr in the object cls with the decorated function."""
7 orig_func = getattr(cls, attr)
10 def wrapped_func(*args, **kwargs):
11 return func(orig_func, *args, **kwargs)
12 setattr(cls, attr, wrapped_func)
16 # Modify jabber.error.exceptionFromStreamError to include the XML element in
18 from twisted.words.protocols.jabber import error as jabber_error
19 @patch(jabber_error, "exceptionFromStreamError")
20 def exceptionFromStreamError(orig, element):
21 exception = orig(element)
22 exception.element = element