Merge "Use the oslo.utils.reflection to extract the class name"

This commit is contained in:
Jenkins
2016-01-09 03:50:57 +00:00
committed by Gerrit Code Review
2 changed files with 8 additions and 2 deletions

View File

@@ -22,6 +22,7 @@ Base utilities to build API operation managers and objects on top of.
import contextlib
import hashlib
import os
from oslo_utils import reflection
from troveclient.compat import exceptions
from troveclient.compat import utils
@@ -264,7 +265,9 @@ class Resource(object):
reprkeys = sorted(k 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)
def get(self):
# set_loaded() first ... so if we have to bail, we know we tried.

View File

@@ -26,6 +26,7 @@ Base utilities to build API operation managers and objects on top of.
import abc
import copy
from oslo_utils import reflection
import six
from six.moves.urllib import parse
@@ -435,7 +436,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):