From b62ea7dd0af02abb6c3716c36722216eb75e5c99 Mon Sep 17 00:00:00 2001 From: Krukov D Date: Mon, 29 Aug 2016 20:37:09 +0300 Subject: [PATCH] Naming consumers that are classmethods (#324) --- channels/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/channels/utils.py b/channels/utils.py index 548c307..423f61f 100644 --- a/channels/utils.py +++ b/channels/utils.py @@ -13,9 +13,11 @@ def name_that_thing(thing): return name_that_thing(thing.im_class) + "." + thing.im_func.func_name # Other named thing if hasattr(thing, "__name__"): - if hasattr(thing, "__class__") and not isinstance(thing, types.FunctionType): + if hasattr(thing, "__class__") and not isinstance(thing, (types.FunctionType, types.MethodType)): if thing.__class__ is not type: return name_that_thing(thing.__class__) + if hasattr(thing, "__self__"): + return "%s.%s" % (thing.__self__.__module__, thing.__self__.__name__) if hasattr(thing, "__module__"): return "%s.%s" % (thing.__module__, thing.__name__) # Generic instance of a class