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
This commit is contained in:
LiuNanke
2016-01-08 15:39:16 +08:00
parent 6097b0ce2e
commit 53c56e3fd4

View File

@@ -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):