aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/media_types
diff options
context:
space:
mode:
authorJessica Tallon <jessica@megworld.co.uk>2014-07-28 23:36:39 +0100
committerJessica Tallon <jessica@megworld.co.uk>2014-07-30 21:53:52 +0100
commit5e5d445890c6c555dff48b1613c285da983d71c8 (patch)
tree6c04e0e8f2d455c3ebae77d3b6c65939dc388025 /mediagoblin/media_types
parent138d934f014d2c9c54e247298318832e88dceadb (diff)
downloadmediagoblin-5e5d445890c6c555dff48b1613c285da983d71c8.tar.lz
mediagoblin-5e5d445890c6c555dff48b1613c285da983d71c8.tar.xz
mediagoblin-5e5d445890c6c555dff48b1613c285da983d71c8.zip
Fix #927 - Clean up federation code after Elrond's review
- Add json_error and use inplace of json_response where appropriate. - Add garbage_collection to config spec file. - Fix bugs in both garbage collection task and test - Handle /api/whoami when no user logged in and a test for such a case. - Validate ID is correct and user has comment privilege to comment.
Diffstat (limited to 'mediagoblin/media_types')
-rw-r--r--mediagoblin/media_types/image/__init__.py35
1 files changed, 0 insertions, 35 deletions
diff --git a/mediagoblin/media_types/image/__init__.py b/mediagoblin/media_types/image/__init__.py
index 96081068..11f90ca5 100644
--- a/mediagoblin/media_types/image/__init__.py
+++ b/mediagoblin/media_types/image/__init__.py
@@ -19,9 +19,6 @@ import logging
from mediagoblin.media_types import MediaManagerBase
from mediagoblin.media_types.image.processing import sniff_handler, \
ImageProcessingManager
-from mediagoblin.tools.response import json_response
-from mediagoblin.submit.lib import prepare_queue_task, run_process_media
-from mediagoblin.notifications import add_comment_subscription
_log = logging.getLogger(__name__)
@@ -58,38 +55,6 @@ class ImageMediaManager(MediaManagerBase):
except (KeyError, ValueError):
return None
- @staticmethod
- def api_upload_request(request, file_data, entry):
- """ 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 = file_data.filename
- entry.generate_slug()
-
- queue_file = prepare_queue_task(request.app, entry, file_data.filename)
- with queue_file:
- 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',
- qualified=True, user=request.user.username)
-
- run_process_media(entry, feed_url)
- add_comment_subscription(request.user, entry)
- return json_response(entry.serialize(request))
-
def get_media_type_and_manager(ext):
if ext in ACCEPTED_EXTENSIONS:
return MEDIA_TYPE, ImageMediaManager