def actual_add_asset_type(self, assetClass, assetClassEn, lpathList, nLen): try: checkList = [] checkList.append(assetClass) checkList.append(assetClassEn) if not all(checkList): LOG.error("add new asset class params are empty!!!") return -1, u"填写内容为空,请检查" # 得到ltree路径 leafNode = lpathList[nLen - 1] assetPath = self.getAssetTypePath(leafNode) newPath = assetPath + "." + assetClassEn.lower() ast = AssetTypeDal() assetTypeModel = ast.get_asset_type_by_name_or_path(assetClass, newPath) if assetTypeModel: return -1, assetClass + "或者" + newPath + "已经存在,添加失败" ast.add_asset_type(assetClass, newPath) return 0, u"添加成功" except Exception as _ex: LOG.error("error occured while add asset class: %s" % str(_ex)) return -1, u"添加失败"