Comment 0 for bug 1282514

Revision history for this message
Shuangtai Tian (shuangtai-tian) wrote :

for code compatible with Python 3, we should use the "__self__" instead of "im_self".
for example :
cinder/volume/flows/common.py

def make_pretty_name(method):
    """Makes a pretty name for a function/method."""
    meth_pieces = [method.__name__]
    # If its an instance method attempt to tack on the class name
    if hasattr(method, 'im_self') and method.im_self is not None:
        try:
            meth_pieces.insert(0, method.im_self.__class__.__name__)
        except AttributeError:
            pass
    return ".".join(meth_pieces)