aboutsummaryrefslogtreecommitdiff
path: root/server/szurubooru/func/posts.py
diff options
context:
space:
mode:
authorrr-2016-10-02 17:21:15 +0200
committerrr-2016-10-02 17:21:15 +0200
commitb853caf6f5d8c97f27a8026c31caf0a01759d6a3 (patch)
tree7c32ef127bb5e6cbbfb1f8591d97ebb2a59da3f0 /server/szurubooru/func/posts.py
parentb0c50310011eaafd55956ddea4b2d37b3556fc7e (diff)
server/posts: fix relation updating
Fixes #103
Diffstat (limited to 'server/szurubooru/func/posts.py')
-rw-r--r--server/szurubooru/func/posts.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/server/szurubooru/func/posts.py b/server/szurubooru/func/posts.py
index 3863e5b..ee43b92 100644
--- a/server/szurubooru/func/posts.py
+++ b/server/szurubooru/func/posts.py
@@ -355,8 +355,13 @@ def update_post_tags(post, tag_names):
def update_post_relations(post, new_post_ids):
assert post
+ try:
+ new_post_ids = [int(id) for id in new_post_ids]
+ except ValueError:
+ raise InvalidPostRelationError(
+ 'A relation must be numeric post ID.')
old_posts = post.relations
- old_post_ids = [p.post_id for p in old_posts]
+ old_post_ids = [int(p.post_id) for p in old_posts]
new_posts = db.session \
.query(db.Post) \
.filter(db.Post.post_id.in_(new_post_ids)) \

© 2015 - 2026 Jakob L. Kreuze