reflection: need clean nested class's name with prefix in Python 3
Bug #1513067 reported by
ChangBo Guo(gcb)
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
oslo.utils |
Fix Released
|
Low
|
ChangBo Guo(gcb) |
Bug Description
A nested class returns class name with nested prefix in Python 3,
but only returns class name in Python 2, in order to keep consistent
need remove the prefix
Changed in oslo.utils: | |
assignee: | nobody → ChangBo Guo(gcb) (glongwave) |
Changed in oslo.utils: | |
milestone: | none → 2.8.0 |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
This is an example:
[gcb@localhost tests]$ cat test_reflect.py
import pdb
from oslo_utils import reflection
class ClassA(object):
def __init__(self):
class ClassB(object):
pass
self.api = ClassB()
def test_get_ nested_ class_name( self): get_class_ name(self. api, fully_qualified =False)
print( class_name) get_class_ name(self. api, fully_qualified =True)
print( class_name)
class_name = reflection.
class_name = reflection.
a = ClassA() get_nested_ class_name( )
a.test_
[gcb@localhost tests]$ python test_reflect.py
ClassB
__main__.ClassB
[gcb@localhost tests]$ python3 test_reflect.py __init_ _.<locals> .ClassB _.ClassA. __init_ _.<locals> .ClassB
ClassA.
__main_