aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/submit
diff options
context:
space:
mode:
authorJessica Tallon <jessica@megworld.co.uk>2014-10-29 08:47:09 +0000
committerJessica Tallon <jessica@megworld.co.uk>2014-10-29 08:47:12 +0000
commitbc2c06a10d9c15ec161f51e8d942cb2e5028ce47 (patch)
treea885d6be4473957cb8d477e172c66d283b16e055 /mediagoblin/submit
parentc5f258fec07b9791b35d52298dd71954de81ef20 (diff)
downloadmediagoblin-bc2c06a10d9c15ec161f51e8d942cb2e5028ce47.tar.lz
mediagoblin-bc2c06a10d9c15ec161f51e8d942cb2e5028ce47.tar.xz
mediagoblin-bc2c06a10d9c15ec161f51e8d942cb2e5028ce47.zip
Fix #1017 - Exception caused by activity being set on incorrect foreign key
The .activity ForeignKey on several models such as MediaEntry expects a ActivityIntmediatory ID not an Activity ID however in submit code the activity attribute was being set the Activity, simply removing this assignment should fix the issue as everything is set correctly at this point. I have also moved the creation of the activity above the processing of media to avoid race conditions.
Diffstat (limited to 'mediagoblin/submit')
-rw-r--r--mediagoblin/submit/lib.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/mediagoblin/submit/lib.py b/mediagoblin/submit/lib.py
index ea24ec5c..ea05e00f 100644
--- a/mediagoblin/submit/lib.py
+++ b/mediagoblin/submit/lib.py
@@ -195,18 +195,18 @@ def submit_media(mg_app, user, submitted_file, filename,
else:
feed_url = None
+ add_comment_subscription(user, entry)
+
+ # Create activity
+ create_activity("post", entry, entry.uploader)
+ entry.save()
+
# Pass off to processing
#
# (... don't change entry after this point to avoid race
# conditions with changes to the document via processing code)
run_process_media(entry, feed_url)
- add_comment_subscription(user, entry)
-
- # Create activity
- entry.activity = create_activity("post", entry, entry.uploader).id
- entry.save()
-
return entry
@@ -291,11 +291,11 @@ def api_add_to_feed(request, entry):
qualified=True, user=request.user.username
)
- run_process_media(entry, feed_url)
add_comment_subscription(request.user, entry)
# Create activity
- entry.activity = create_activity("post", entry, entry.uploader).id
+ create_activity("post", entry, entry.uploader)
entry.save()
+ run_process_media(entry, feed_url)
return json_response(entry.serialize(request))