aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-07-14 09:33:26 +1200
committerAldo Cortesi <aldo@nullcube.com>2016-07-14 09:33:26 +1200
commit696789b8ec41c6189226896c93eb121014946eff (patch)
treea4fc19a4bf1f159d8debedc4cbc6c03830a41ae2
parent07c3f90c5b502850ce963f1c1e931bfb7b9361ec (diff)
downloadmitmproxy-696789b8ec41c6189226896c93eb121014946eff.tar.gz
mitmproxy-696789b8ec41c6189226896c93eb121014946eff.tar.bz2
mitmproxy-696789b8ec41c6189226896c93eb121014946eff.zip
func.__name__ works in both 2.7 and 3.5
Thanks to @resam and @dwfreed for pointing this out
-rw-r--r--mitmproxy/controller.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/mitmproxy/controller.py b/mitmproxy/controller.py
index 8b968eb5..2f0c8bf2 100644
--- a/mitmproxy/controller.py
+++ b/mitmproxy/controller.py
@@ -197,9 +197,7 @@ def handler(f):
with master.handlecontext():
ret = f(master, message)
if handling:
- # Python2/3 compatibility hack
- fn = getattr(f, "func_name", None) or getattr(f, "__name__")
- master.addons(fn, message)
+ master.addons(f.__name__, message)
if handling and not message.reply.acked and not message.reply.taken:
message.reply.ack()