flask_app.py 文件源码

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

项目:AtlassianBot 作者: gpailler 项目源码 文件源码
def convert(content_type, content):
    cachekey = request.path

    cachevalue = cache.get(cachekey)

    if cachevalue is None:
        content = decode(content)
        content_type = decode(content_type).decode()
        if content_type.startswith('image/svg+xml'):
            content = __svg2png(content)
            content_type = 'image/png'

        cache.set(cachekey, (content, content_type), timeout=CACHE_RETENTION)
    else:
        content = cachevalue[0]
        content_type = cachevalue[1]

    response = make_response(content)
    response.content_type = content_type
    response.cache_control.max_age = CACHE_RETENTION
    return response
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号