From 53c56e3fd4a600daea151d8bd7d6b3295b7d3f29 Mon Sep 17 00:00:00 2001 From: LiuNanke Date: Fri, 8 Jan 2016 15:39:16 +0800 Subject: [PATCH] Use the oslo.utils.reflection to extract the class name The oslo.utils reflection module/code handles more variations of where a class name may come from (on python 2 and python 3) so its usage allows getting more accurate class names so we might as well use it. Change-Id: Ic6a1d4a34336ae6501c48e92e8114932c283650f --- ceilometerclient/openstack/common/apiclient/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ceilometerclient/openstack/common/apiclient/base.py b/ceilometerclient/openstack/common/apiclient/base.py index 8493b441..17016eb8 100644 --- a/ceilometerclient/openstack/common/apiclient/base.py +++ b/ceilometerclient/openstack/common/apiclient/base.py @@ -43,6 +43,7 @@ import copy from oslo_utils import strutils import six from six.moves.urllib import parse +from oslo_utils import reflection from ceilometerclient.openstack.common._i18n import _ from ceilometerclient.openstack.common.apiclient import exceptions @@ -463,7 +464,9 @@ class Resource(object): for k in self.__dict__.keys() if k[0] != '_' and k != 'manager') info = ", ".join("%s=%s" % (k, getattr(self, k)) for k in reprkeys) - return "<%s %s>" % (self.__class__.__name__, info) + self_cls_name = reflection.get_class_name(self, + fully_qualified=False) + return "<%s %s>" % (self_cls_name, info) @property def human_id(self):