本文整理汇总了Python中oasis.lib.DB.get_qt_att_fname方法的典型用法代码示例。如果您正苦于以下问题:Python DB.get_qt_att_fname方法的具体用法?Python DB.get_qt_att_fname怎么用?Python DB.get_qt_att_fname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oasis.lib.DB
的用法示例。
在下文中一共展示了DB.get_qt_att_fname方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_q_att_fname
# 需要导入模块: from oasis.lib import DB [as 别名]
# 或者: from oasis.lib.DB import get_qt_att_fname [as 别名]
def get_q_att_fname(qid, name):
""" Return (mimetype, filename) with the relevant filename.
If it's not found in question, look in questiontemplate.
"""
qtid = DB.get_q_parent(qid)
variation = DB.get_q_variation(qid)
version = DB.get_q_version(qid)
# for the two biggies we hit the question first,
# otherwise check the question template first
if name == "image.gif" or name == "qtemplate.html":
fname = DB.get_q_att_fname(qtid, name, variation, version)
if fname:
return DB.get_q_att_mimetype(qtid, name, variation, version), fname
fname = DB.get_qt_att_fname(qtid, name, version)
if fname:
return DB.get_qt_att_mimetype(qtid, name, version), fname
else:
fname = DB.get_qt_att_fname(qtid, name, version)
if fname:
return DB.get_qt_att_mimetype(qtid, name, version), fname
fname = DB.get_q_att_fname(qtid, name, variation, version)
if fname:
return DB.get_q_att_mimetype(qtid, name, variation, version), fname
return None, None
示例2: q_att_details
# 需要导入模块: from oasis.lib import DB [as 别名]
# 或者: from oasis.lib.DB import get_qt_att_fname [as 别名]
def q_att_details(qtid, version, variation, name):
""" Find a question attachment and return its details. """
# for the two biggies we hit the question first,
# otherwise check the question template first
if name == "image.gif" or name == "qtemplate.html":
fname = DB.get_q_att_fname(qtid, name, variation, version)
if fname:
return DB.get_q_att_mimetype(qtid, name, variation, version), fname
fname = DB.get_qt_att_fname(qtid, name, version)
if fname:
return DB.get_qt_att_mimetype(qtid, name, version), fname
else:
fname = DB.get_qt_att_fname(qtid, name, version)
if fname:
return DB.get_qt_att_mimetype(qtid, name, version), fname
fname = DB.get_q_att_fname(qtid, name, variation, version)
if fname:
return DB.get_q_att_mimetype(qtid, name, variation, version), fname
return None, None