Ensure keys exist or don't exist before using them or adding them, respectively

This commit is contained in:
Dan Williams 2006-05-22 12:51:39 -04:00
parent 3f320fcc52
commit 6998f6b3a6

View File

@ -69,12 +69,14 @@ class LocalGroup(Group):
def add_service(self, service):
sid = (service.get_name(), service.get_type())
self._services[sid] = service
self._notify_service_added(service)
if not self._services.has_key(sid):
self._services[sid] = service
self._notify_service_added(service)
def remove_service(self, service_id):
self._notify_service_removed(service_id)
del self._services[service_id]
if self._services.has_key(service_id):
self._notify_service_removed(service_id)
del self._services[service_id]
def join(self):
self._owner.register()