Mercurial > libervia-backend
comparison src/tools/common/data_objects.py @ 2537:8cf58a415126
tools (common/data_objects): fixed Identity
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 26 Mar 2018 08:06:35 +0200 |
parents | 0046283a285d |
children |
comparison
equal
deleted
inserted
replaced
2536:27539029a662 | 2537:8cf58a415126 |
---|---|
292 | 292 |
293 def __init__(self, jid_str, data=None): | 293 def __init__(self, jid_str, data=None): |
294 self.jid_str = jid_str | 294 self.jid_str = jid_str |
295 self.data = data if data is not None else {} | 295 self.data = data if data is not None else {} |
296 | 296 |
297 @property | 297 def __getitem__(self, key): |
298 def nick(self): | 298 return self.data[key] |
299 return self.data.get(u'nick') | 299 |
300 def __getattr__(self, key): | |
301 try: | |
302 return self.data[key] | |
303 except KeyError: | |
304 raise AttributeError(key) | |
300 | 305 |
301 | 306 |
302 class Identities(object): | 307 class Identities(object): |
303 | 308 |
304 def __init__(self): | 309 def __init__(self): |