ignores __name__ class attribute when generating paths

Bug #484899 reported by Marius Gedminas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ZODB Browser
Fix Released
Medium
Unassigned

Bug Description

Imagine code like this:

    class MyPersistentClass(Persistent):
        __name__ = 'something'

    some_persistent_obj.attr = obj = MyPersistentClass()
    some_persistent_obj.attr.__parent__ = some_persistent_obj

Now Zope's absoluteURL and the like will see the obj as being /.../something, but ZODBBrowser will see /.../???.

ZodbObjectState(obj).getName() should pay attention to class attributes, not just the state dictionary.

Revision history for this message
Marius Gedminas (mgedmin) wrote :

Just a note: due to magicness of __class__.__name__, ZodbObjectState.getName should look directly in obj.__class__.__dict__:

>>> class MyClass(object):
... __name__ = 'foo'
...
>>> c = MyClass()
>>> c.__name__
'foo'
>>> c.__class__.__name__
'MyClass'
>>> c.__class__.__dict__.get('__name__')
'foo'

Revision history for this message
Marius Gedminas (mgedmin) wrote :

Will be fixed in 0.5

Changed in zodbbrowser:
status: New → Fix Committed
Changed in zodbbrowser:
importance: Undecided → Medium
Changed in zodbbrowser:
status: Fix Committed → Fix Released
Changed in zodbbrowser:
milestone: none → 0.5
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.