mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
get_entities was separated from translate_event
This commit is contained in:
parent
ac1f7e72c1
commit
fb73402251
1 changed files with 12 additions and 7 deletions
|
|
@ -52,11 +52,20 @@ class BaseEvent(BaseHandler):
|
||||||
|
|
||||||
def _translate_event(self, session, event):
|
def _translate_event(self, session, event):
|
||||||
'''Return *event* translated structure to be used with the API.'''
|
'''Return *event* translated structure to be used with the API.'''
|
||||||
_selection = event['data'].get('entities', [])
|
return [
|
||||||
|
self._get_entities(session, event),
|
||||||
|
event
|
||||||
|
]
|
||||||
|
|
||||||
|
def _get_entities(
|
||||||
|
self, session, event, ignore=['socialfeed', 'socialnotification']
|
||||||
|
):
|
||||||
|
_selection = event['data'].get('entities', [])
|
||||||
_entities = list()
|
_entities = list()
|
||||||
|
if isinstance(ignore, str):
|
||||||
|
ignore = list(ignore)
|
||||||
for entity in _selection:
|
for entity in _selection:
|
||||||
if entity['entityType'] in ['socialfeed', 'socialnotification']:
|
if entity['entityType'] in ignore:
|
||||||
continue
|
continue
|
||||||
_entities.append(
|
_entities.append(
|
||||||
(
|
(
|
||||||
|
|
@ -66,8 +75,4 @@ class BaseEvent(BaseHandler):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
return _entities
|
||||||
return [
|
|
||||||
_entities,
|
|
||||||
event
|
|
||||||
]
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue