db.py 文件源码

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

项目:lantern-detection 作者: gongxijun 项目源码 文件源码
def aparam():
    """
    Returns the appropriate string to be used to interpolate
    a value with the current `web.ctx.db_module` or simply %s
    if there isn't one.

        >>> aparam()
        '%s'
    """
    if hasattr(web.ctx, 'db_module'):
        style = web.ctx.db_module.paramstyle
    else:
        style = 'pyformat'

    if style == 'qmark': 
        return '?'
    elif style == 'numeric': 
        return ':1'
    elif style in ['format', 'pyformat']: 
        return '%s'
    raise UnknownParamstyle, style
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号