diff options
| author | rr- <rr-@sakuya.pl> | 2016-09-10 10:14:53 +0200 |
|---|---|---|
| committer | rr- <rr-@sakuya.pl> | 2016-09-10 10:16:14 +0200 |
| commit | 8674c8b50e9988162aeeb57df23ef334f2701e93 (patch) | |
| tree | d572eeebca63bb27c1cd5baa13e23a51461b0f31 /server/szurubooru/func/posts.py | |
| parent | 0a19e7bbd08c70b2728b127570cd032a00e8d244 (diff) | |
server/posts: report duplicate post ID and URL
Diffstat (limited to 'server/szurubooru/func/posts.py')
| -rw-r--r-- | server/szurubooru/func/posts.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/server/szurubooru/func/posts.py b/server/szurubooru/func/posts.py index b7ffe2b..3863e5b 100644 --- a/server/szurubooru/func/posts.py +++ b/server/szurubooru/func/posts.py @@ -20,7 +20,13 @@ class PostAlreadyFeaturedError(errors.ValidationError): class PostAlreadyUploadedError(errors.ValidationError): - pass + def __init__(self, other_post): + super().__init__( + 'Post already uploaded (%d)' % other_post.post_id, + { + 'otherPostUrl': get_post_content_url(other_post), + 'otherPostId': other_post.post_id, + }) class InvalidPostIdError(errors.ValidationError): @@ -303,8 +309,7 @@ def update_post_content(post, content): if other_post \ and other_post.post_id \ and other_post.post_id != post.post_id: - raise PostAlreadyUploadedError( - 'Post already uploaded (%d)' % other_post.post_id) + raise PostAlreadyUploadedError(other_post) post.file_size = len(content) try: |