move identmap-action from __add__ to __get__

This commit is contained in:
Thor77 2015-07-31 13:09:08 +02:00
parent 2361211e55
commit a914b96b39
1 changed files with 2 additions and 2 deletions

View File

@ -40,8 +40,6 @@ class Clients:
return False
def __add__(self, id_or_uid):
if id_or_uid in self.ident_map:
id_or_uid = self.ident_map[id_or_uid]
if self.is_id(id_or_uid):
if id_or_uid not in self.clients_by_id:
self.clients_by_id[id_or_uid] = Client(id_or_uid)
@ -51,6 +49,8 @@ class Clients:
return self
def __getitem__(self, id_or_uid):
if id_or_uid in self.ident_map:
id_or_uid = self.ident_map[id_or_uid]
if self.is_id(id_or_uid):
if id_or_uid not in self.clients_by_id:
self += id_or_uid