dbus.service.Object.remove_from_connection does not reset _object_path
Submitted by Filip Štědronský
Assigned to Simon McVittie
Description
When calling remove_from_connection on a single-location object, _locations gets emptied but _object_path remains set. Thus it's impossible to re-add the object to the connection under a different name.
bus=dbus.SessionBus() o=dbus.service.Object() o.add_to_connection(bus, '/a') o._object_path, o._locations ('/a', [(<dbus._dbus.SessionBus (session) at 0x92552fc>, '/a', False)]) o.remove_from_connection() o._object_path, o._locations ('/a', []) o.add_to_connection(bus, '/b') Traceback (most recent call last): File "
<stdin>
", line 1, in<module>
File "/usr/lib/python2.7/site-packages/dbus/service.py", line 567, in add_to_connection 'path %s' % (self, self._object_path)) ValueError: <dbus.service.Object at /a at 0xb735498c> is already exported at object path /a