Merge pull request #3192 from edx/ned/fix-encode-error-when-hashing-resources

Fix hash_resource to avoid encode errors.
This commit is contained in:
Ned Batchelder
2014-04-02 22:03:00 -04:00

View File

@@ -55,11 +55,10 @@ xmodule.x_module.descriptor_global_local_resource_url = local_resource_url
def hash_resource(resource):
"""
Hash a :class:`xblock.fragment.FragmentResource
Hash a :class:`xblock.fragment.FragmentResource`.
"""
md5 = hashlib.md5()
for data in resource:
md5.update(data)
md5.update(repr(resource))
return md5.hexdigest()