def serialize(self, dumps=False): data = { 'uuid': self.uuid.hex, 'timestamp': to_timestamp(self.datetime), 'type': self.event_type, 'data': self.data, } return dumps_htmlsafe(data) if dumps else data
def serialize(self, dumps=False): data = { 'uuid': self.uuid.hex, 'timestamp': to_timestamp(self.datetime), 'type': self.event_type, 'data': self.data, } return dumps_htmlsafe(data) if dumps else data
def serialize(self, dumps=False, include_actor_name=True): _data = self.data if not include_actor_name and self.actor and self.actor_name in _data: _data = copy.deepcopy(self.data) _data.pop(self.actor_name) data = { 'uuid': self.uuid.hex, 'timestamp': to_timestamp(self.datetime), 'type': self.event_type, 'data': _data, } return dumps_htmlsafe(data) if dumps else data
def serialize(self, dumps: bool = False, include_actor_name: bool = True, include_instance_info: bool = False) -> Union[str, Dict]: _data = self.data if not include_actor_name and self.actor and self.actor_name in _data: _data = copy.deepcopy(self.data) _data.pop(self.actor_name) data = { 'uuid': self.uuid.hex, 'timestamp': to_timestamp(self.datetime), 'type': self.event_type, 'ref_id': self.ref_id.hex if self.ref_id else None, 'data': _data, } if include_instance_info: data['instance_id'] = self.instance_id data['instance_contenttype'] = self.instance_contenttype return dumps_htmlsafe(data) if dumps else data