def get_storage_hash(storage):
"""
Return a hex string hash for a storage object (or string containing
'full.path.ClassName' referring to a storage object).
"""
# If storage is wrapped in a lazy object we need to get the real thing.
if isinstance(storage, LazyObject):
if storage._wrapped is None:
storage._setup()
storage = storage._wrapped
if not isinstance(storage, six.string_types):
storage_cls = storage.__class__
storage = '%s.%s' % (storage_cls.__module__, storage_cls.__name__)
return hashlib.md5(storage.encode('utf8')).hexdigest()
评论列表
文章目录