From a914b96b398d48a0044190a04c7aea83c5191c88 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Fri, 31 Jul 2015 13:09:08 +0200 Subject: [PATCH] move identmap-action from __add__ to __get__ --- tsstats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tsstats.py b/tsstats.py index 6c0e7a1..8c173c6 100755 --- a/tsstats.py +++ b/tsstats.py @@ -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