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
def get_qd_conf(): return qfcache.get_data('qd_conf')
def get_shop_cates(pid=0): all_cates = qfcache.get_data('kuma_shop_cates') or [] return analysis_list(all_cates, pid)
def get_relations(): return qfcache.get_data('relation')