utils.py 文件源码

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

项目:flask_skeleton 作者: Bleezworld 项目源码 文件源码
def ImageUrlToFile(image_url):
    """images are stored as ad-213213.png in the db. We get them from the website as
    /static/upload-debug/ad-213213.png so we trim them.
    Returns True, filepath"""
    BAD_RETURN = False, ''
    prefix = request.url_root + "static/%s/" % app.config[Constants.KEY_UPLOAD_DIR]
    if not image_url.startswith(prefix):
        return BAD_RETURN
    a = image_url.split('/')
    if not a or (image_url != prefix + a[-1]):
        return BAD_RETURN
    return True, a[-1]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号