0012_build_storage_hashes.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:gougo 作者: amaozhao 项目源码 文件源码
def get_storage_hash(self, storage):
        """
        Return a hex string hash for a storage object (or string containing a
        pickle of a storage object).

        """
        try:
            # Make sure that pickle is getting a string, since it can choke
            # with unicode.
            storage_obj = pickle.loads(str(self.pickle))
        except:
            # We need to return some storage, and if there's an exception then
            # it is most likely the default_storage (since that fails with a
            # recursion error due to LazyObject "awesomeness").
            storage_obj = default_storage
        storage_cls = storage_obj.__class__
        name = '%s.%s' % (storage_cls.__module__, storage_cls.__name__)
        return hashlib.md5(name).hexdigest()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号