示例#1
0
def get_constant(code=None, language=None, default_self=True):
    ''' 返回常量

    如果code为空, 返回所有的常量,
    否则返回指定的常量

    '''
    default = code if default_self else None

    cons = qfcache.get_data('language_constant')
    if not code:
        return cons

    try:
        code = decode_from_utf8(code)
        if not cons or code not in cons:
            return default
        else:
            if isinstance(cons[code], types.DictType) and language:
                return cons[code].get(language, default)
            else:
                return cons[code]
    except:
        log.warn(traceback.format_exc())
        return default
示例#2
0
def get_qd_conf():
    return qfcache.get_data('qd_conf')
示例#3
0
def get_shop_cates(pid=0):
    all_cates = qfcache.get_data('kuma_shop_cates') or []

    return analysis_list(all_cates, pid)
示例#4
0
def get_relations():
    return qfcache.get_data('relation')