Commit 115d7358 by Chris Dodge Committed by Calen Pennington

fix up commenting after refactoring. Also, don't reraise an exception during…

fix up commenting after refactoring. Also, don't reraise an exception during thumbnail generation - we just want to swallow the exception, log, and continue.
parent 2153aae6
...@@ -637,6 +637,9 @@ def upload_asset(request, org, course, coursename): ...@@ -637,6 +637,9 @@ def upload_asset(request, org, course, coursename):
thumbnail_file_location = None thumbnail_file_location = None
# if the upload asset is an image, we can generate a thumbnail from it
# let's do so now, so that we have the thumbnail location which we need
# so that the asset can point to it
if mime_type.split('/')[0] == 'image': if mime_type.split('/')[0] == 'image':
try: try:
# not sure if this is necessary, but let's rewind the stream just in case # not sure if this is necessary, but let's rewind the stream just in case
...@@ -677,14 +680,11 @@ def upload_asset(request, org, course, coursename): ...@@ -677,14 +680,11 @@ def upload_asset(request, org, course, coursename):
# catch, log, and continue as thumbnails are not a hard requirement # catch, log, and continue as thumbnails are not a hard requirement
logging.error('Failed to generate thumbnail for {0}. Continuing...'.format(name)) logging.error('Failed to generate thumbnail for {0}. Continuing...'.format(name))
thumbnail_file_location = None thumbnail_file_location = None
raise
file_location = StaticContent.compute_location(org, course, name) file_location = StaticContent.compute_location(org, course, name)
# if we're uploading an asset for which we can generate a thumbnail, let's generate it first so that we have # create a StaticContent entity and point to the thumbnail
# the location to point to
content = StaticContent(file_location, name, mime_type, filedata, thumbnail_location = thumbnail_file_location) content = StaticContent(file_location, name, mime_type, filedata, thumbnail_location = thumbnail_file_location)
# first commit to the DB # first commit to the DB
...@@ -698,11 +698,6 @@ def upload_asset(request, org, course, coursename): ...@@ -698,11 +698,6 @@ def upload_asset(request, org, course, coursename):
# to re-populate the cache. # to re-populate the cache.
del_cached_content(content.location) del_cached_content(content.location)
# if we're uploading an image, then let's generate a thumbnail so that we can
# serve it up when needed without having to rescale on the fly
return HttpResponse('Upload completed') return HttpResponse('Upload completed')
''' '''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment