diff --git a/posts.py b/posts.py index 326677c69..272126773 100644 --- a/posts.py +++ b/posts.py @@ -1072,6 +1072,7 @@ def _create_post_cw_from_reply(base_dir: str, nickname: str, domain: str, """If this is a reply and the original post has a CW then use the same CW """ + reply_to_json = None if in_reply_to and not sensitive: # locate the post which this is a reply to and check if # it has a content warning. If it does then reproduce @@ -1080,16 +1081,16 @@ def _create_post_cw_from_reply(base_dir: str, nickname: str, domain: str, locate_post(base_dir, nickname, domain, in_reply_to) if reply_post_filename: reply_to_json = load_json(reply_post_filename) - if reply_to_json: - if reply_to_json.get('object'): - if reply_to_json['object'].get('sensitive'): - if reply_to_json['object']['sensitive']: - sensitive = True - if reply_to_json['object'].get('summary'): - summary = \ - get_summary_from_post(reply_to_json, - system_language, - languages_understood) + if reply_to_json: + if reply_to_json.get('object'): + if reply_to_json['object'].get('sensitive'): + if reply_to_json['object']['sensitive']: + sensitive = True + if reply_to_json['object'].get('summary'): + summary = \ + get_summary_from_post(reply_to_json, + system_language, + languages_understood) return sensitive, summary