Commit 04614078 by cahrens

Proposed changes to fix asset caching bug.

parent e884f17d
......@@ -753,7 +753,8 @@ def upload_asset(request, org, course, coursename):
# nomenclature since we're using a FileSystem paradigm here. We're just imposing
# the Location string formatting expectations to keep things a bit more consistent
filename = request.FILES['file'].name
# unicode needed for cache equivalency
filename = unicode(request.FILES['file'].name)
mime_type = request.FILES['file'].content_type
filedata = request.FILES['file'].read()
......
......@@ -29,12 +29,14 @@ class StaticContent(object):
@staticmethod
def generate_thumbnail_name(original_name):
return ('{0}'+XASSET_THUMBNAIL_TAIL_NAME).format(os.path.splitext(original_name)[0])
# unicode needed for cache equivalency
return unicode(('{0}'+XASSET_THUMBNAIL_TAIL_NAME).format(os.path.splitext(original_name)[0]))
@staticmethod
def compute_location(org, course, name, revision=None, is_thumbnail=False):
name = name.replace('/', '_')
return Location([XASSET_LOCATION_TAG, org, course, 'asset' if not is_thumbnail else 'thumbnail', Location.clean(name), revision])
# unicode needed for cache equivalency
return Location([unicode(XASSET_LOCATION_TAG), org, course, u'asset' if not is_thumbnail else u'thumbnail', Location.clean(name), revision])
def get_id(self):
return StaticContent.get_id_from_location(self.location)
......
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