Fix hash_resource to avoid encode errors.

This commit is contained in:
Ned Batchelder
2014-04-02 20:13:50 -04:00
parent af486423c8
commit 732bf3f307

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()