aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/media_types
diff options
context:
space:
mode:
authorJessica Tallon <jessica@megworld.co.uk>2014-07-11 15:23:55 +0100
committerJessica Tallon <jessica@megworld.co.uk>2014-07-22 23:13:16 +0100
commit51ab51921e5104f1b71402d38928651562c7134a (patch)
treec83072931ed60b597ff48f036c394f97bb739557 /mediagoblin/media_types
parent967df5eff0c00fe7cd860ebfb297ee1f2e0bcdaf (diff)
downloadmediagoblin-51ab51921e5104f1b71402d38928651562c7134a.tar.lz
mediagoblin-51ab51921e5104f1b71402d38928651562c7134a.tar.xz
mediagoblin-51ab51921e5104f1b71402d38928651562c7134a.zip
Add more tests for federation APIs
Diffstat (limited to 'mediagoblin/media_types')
-rw-r--r--mediagoblin/media_types/image/__init__.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/mediagoblin/media_types/image/__init__.py b/mediagoblin/media_types/image/__init__.py
index 7b9296fe..96081068 100644
--- a/mediagoblin/media_types/image/__init__.py
+++ b/mediagoblin/media_types/image/__init__.py
@@ -63,10 +63,7 @@ class ImageMediaManager(MediaManagerBase):
""" This handles a image upload request """
# Use the same kind of method from mediagoblin/submit/views:submit_start
entry.media_type = unicode(MEDIA_TYPE)
- entry.title = unicode(request.args.get("title", file_data.filename))
- entry.description = unicode(request.args.get("description", ""))
- entry.license = request.args.get("license", "") # not part of the standard API
-
+ entry.title = file_data.filename
entry.generate_slug()
queue_file = prepare_queue_task(request.app, entry, file_data.filename)
@@ -74,6 +71,16 @@ class ImageMediaManager(MediaManagerBase):
queue_file.write(request.data)
entry.save()
+ return json_response(entry.serialize(request))
+
+ @staticmethod
+ def api_add_to_feed(request, entry):
+ """ Add media to Feed """
+ if entry.title:
+ # Shame we have to do this here but we didn't have the data in
+ # api_upload_request as no filename is usually specified.
+ entry.slug = None
+ entry.generate_slug()
feed_url = request.urlgen(
'mediagoblin.user_pages.atom_feed',