tools (common/data_objects): new avatar_basename property
This commit is contained in:
parent
f85cdc7f37
commit
5b217e1b40
1 changed files with 8 additions and 0 deletions
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
from sat.core.constants import Const as C
|
||||
from sat.tools.common import data_format
|
||||
from os.path import basename
|
||||
|
||||
try:
|
||||
from jinja2 import Markup as safe
|
||||
|
|
@ -361,6 +362,13 @@ class Identity(object):
|
|||
self.jid_str = jid_str
|
||||
self.data = data if data is not None else {}
|
||||
|
||||
@property
|
||||
def avatar_basename(self):
|
||||
try:
|
||||
return basename(self.data['avatar']['path'])
|
||||
except (TypeError, KeyError):
|
||||
return None
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self.data[key]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue