# HG changeset patch # User neko259 # Date 2017-01-25 08:31:54 # Node ID c7821a56853ca58c155dbf3a2d389aefa4ecc073 # Parent 772d4b193ca2096565b16271211d03fc0c0b6a4a Don't allow parsing a post when its thread is not parsed yet diff --git a/boards/models/post/sync.py b/boards/models/post/sync.py --- a/boards/models/post/sync.py +++ b/boards/models/post/sync.py @@ -16,6 +16,7 @@ EXCEPTION_DOWNLOAD = 'File was not downl EXCEPTION_HASH = 'File hash does not match attachment hash.' EXCEPTION_SIGNATURE = 'Invalid model signature for {}.' EXCEPTION_AUTHOR_SIGNATURE = 'Model {} has no author signature.' +EXCEPTION_THREAD = 'No thread exists for post {}' ENCODING_UNICODE = 'unicode' TAG_MODEL = 'model' @@ -217,7 +218,7 @@ class SyncManager: if exists: opening_post = Post.objects.get(global_id=op_global_id) else: - logger.debug('No thread exists for post {}'.format(global_id)) + raise Exception(EXCEPTION_THREAD.format(global_id)) else: opening_post = None tag_tags = tag_content.find(TAG_TAGS) @@ -375,4 +376,4 @@ class SyncManager: if opening_post: ThreadFilter().add_filter(model, opening_post) - return et.tostring(request, 'unicode') \ No newline at end of file + return et.tostring(request, 'unicode')