mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
logging on post_json_to_model
This commit is contained in:
parent
690bb34eff
commit
bacc0c81be
1 changed files with 61 additions and 57 deletions
|
@ -578,6 +578,7 @@ def actor_json_to_model(activity_json, address, server):
|
|||
|
||||
|
||||
def post_json_to_model(post_json, user, community) -> Post:
|
||||
try:
|
||||
post = Post(user_id=user.id, community_id=community.id,
|
||||
title=html.unescape(post_json['name']),
|
||||
comments_enabled=post_json['commentsEnabled'],
|
||||
|
@ -638,6 +639,9 @@ def post_json_to_model(post_json, user, community) -> Post:
|
|||
community.post_count += 1
|
||||
db.session.commit()
|
||||
return post
|
||||
except KeyError as e:
|
||||
current_app.logger.error(f'KeyError in post_json_to_model: ' + str(post_json))
|
||||
return None
|
||||
|
||||
|
||||
# Save two different versions of a File, after downloading it from file.source_url. Set a width parameter to None to avoid generating one of that size
|
||||
|
|
Loading…
Add table
Reference in a new issue