views.py 文件源码

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

项目:SuperOcto 作者: mcecchi 项目源码 文件源码
def _cache_key(ui, url=None, locale=None, additional_key_data=None):
    if url is None:
        url = request.base_url
    if locale is None:
        locale = g.locale.language if g.locale else "en"

    k = "ui:{}:{}:{}".format(ui, url, locale)
    if callable(additional_key_data):
        try:
            ak = additional_key_data()
            if ak:
                # we have some additional key components, let's attach them
                if not isinstance(ak, (list, tuple)):
                    ak = [ak]
                k = "{}:{}".format(k, ":".join(ak))
        except:
            _logger.exception("Error while trying to retrieve additional cache key parts for ui {}".format(ui))
    return k
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号