Use .get() instead
This commit is contained in:
@@ -44,7 +44,7 @@ def get_customization_info(thread):
|
|||||||
rtn['nicknames'] = {}
|
rtn['nicknames'] = {}
|
||||||
for k in info['participant_customizations']:
|
for k in info['participant_customizations']:
|
||||||
rtn['nicknames'][k['participant_id']] = k.get('nickname')
|
rtn['nicknames'][k['participant_id']] = k.get('nickname')
|
||||||
elif info['participant_customizations']:
|
elif info.get('participant_customizations'):
|
||||||
_id = thread.get('thread_key', {}).get('other_user_id') or thread.get('id')
|
_id = thread.get('thread_key', {}).get('other_user_id') or thread.get('id')
|
||||||
if info['participant_customizations'][0]['participant_id'] == _id:
|
if info['participant_customizations'][0]['participant_id'] == _id:
|
||||||
rtn['nickname'] = info['participant_customizations'][0]
|
rtn['nickname'] = info['participant_customizations'][0]
|
||||||
|
Reference in New Issue
Block a user