Mercurial > libervia-backend
changeset 2537:8cf58a415126
tools (common/data_objects): fixed Identity
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 26 Mar 2018 08:06:35 +0200 (2018-03-26) |
parents | 27539029a662 |
children | 0a22dc80d671 |
files | src/tools/common/data_objects.py |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/tools/common/data_objects.py Mon Mar 26 08:01:06 2018 +0200 +++ b/src/tools/common/data_objects.py Mon Mar 26 08:06:35 2018 +0200 @@ -294,9 +294,14 @@ self.jid_str = jid_str self.data = data if data is not None else {} - @property - def nick(self): - return self.data.get(u'nick') + def __getitem__(self, key): + return self.data[key] + + def __getattr__(self, key): + try: + return self.data[key] + except KeyError: + raise AttributeError(key) class Identities(object):