refactor(ops): Optimize the iteration for filter_none_values and use logging.error to record logs when an exception occurs (#8461)
This commit is contained in:
@@ -6,12 +6,15 @@ from models.model import Message
|
||||
|
||||
|
||||
def filter_none_values(data: dict):
|
||||
new_data = {}
|
||||
for key, value in data.items():
|
||||
if value is None:
|
||||
continue
|
||||
if isinstance(value, datetime):
|
||||
data[key] = value.isoformat()
|
||||
return {key: value for key, value in data.items() if value is not None}
|
||||
new_data[key] = value.isoformat()
|
||||
else:
|
||||
new_data[key] = value
|
||||
return new_data
|
||||
|
||||
|
||||
def get_message_data(message_id):
|
||||
|
Reference in New Issue
Block a user