def getCompanyName(self, short, lang): try: ret = CompanyInfo.find(company_short = short) if len(ret) == 1: if lang == 'zh': return ret[0].company_zh else: return "" except: msg = traceback.format_exc() self.logger.error(msg) DBBase.Session.rollback() DBBase.Engine.dispose() return None
def getCompanyName(self, short, lang): try: ret = CompanyInfo.find(company_short=short) if len(ret) == 1: if lang == 'zh': return ret[0].company_zh else: return "" except: msg = traceback.format_exc() self.logger.error(msg) DBBase.Session.rollback() DBBase.Engine.dispose() return None
def getCompanyList(self, lang): try: ret = CompanyInfo.find() company_info_list = [] for one in ret: one_hash = {} one_hash['short'] = one.company_short if lang == 'zh': one_hash['full'] = one.company_zh company_info_list.append(one_hash) return company_info_list except: msg = traceback.format_exc() self.logger.error(msg) DBBase.Session.rollback() DBBase.Engine.dispose() return None