def create(**kwargs): # 1 获取参数 # print kwargs # 2 检查参数 # for field in kwargs.keys(): # # 2.1 验证参数是否在idc表中 # if not hasattr(Idc, field): # # logging # current_app.logger.warning( # "参数错误,{} 不在Idc这张表中".format(field) # ) # raise Exception("params error: {}".format(field)) # # 2.2 不能为空 # if not kwargs.get(field, None): # # logging # current_app.logger.warning( # "参数错误,{} 不能为空".format(field) # ) # raise Exception("{} 不能为空".format(field)) check_field_exists(Idc, kwargs) # 3 插入到数据库 idc = Idc(**kwargs) db.session.add(idc) try: db.session.commit() except Exception, e: # logging current_app.logger.warning( "commit error: {}".format(e.message) ) raise Exception("commit error")
def create(**kwargs): # 1 获取参数 # print kwargs # 2 检查参数 # for field in kwargs.keys(): # # 2.1 验证参数是否在idc表中 # if not hasattr(Idc, field): # # logging # current_app.logger.warning( # "参数错误,{} 不在Idc这张表中".format(field) # ) # raise Exception("params error: {}".format(field)) # # 2.2 不能为空 # if not kwargs.get(field, None): # # logging # current_app.logger.warning( # "参数错误,{} 不能为空".format(field) # ) # raise Exception("{} 不能为空".format(field)) check_field_exists(Idc, kwargs) # 3 插入到数据库 idc = Idc(**kwargs) db.session.add(idc) try: db.session.commit() except Exception, e: # logging current_app.logger.warning("commit error: {}".format(e.message)) raise Exception("commit error")
def create(**kwargs): check_field_exists(Manufacturers, kwargs) record = Manufacturers(**kwargs) db.session.add(record) try: db.session.commit() except Exception,e: raise Exception(e.message.split(") ")[1])
def create(**kwargs): check_field_exists(Idc, kwargs) idc = Idc(**kwargs) db.session.add(idc) try: db.session.commit() except Exception,e: raise Exception(e.message.split(") ")[1])
def create(**kwargs): check_field_exists(Power, kwargs) power = Power(**kwargs) db.session.add(power) try: db.session.commit() except Exception,e: raise Exception(e.message.split(") ")[1])
def create(**kwargs): check_field_exists(Supplier, kwargs) record = Supplier(**kwargs) db.session.add(record) try: db.session.commit() except Exception,e: raise Exception(e.message.split(") ")[1])
def create(**kwargs): #1.获取参数信息 check_field_exists(Power, kwargs) #2.传参个数验证 obj = Power(**kwargs) #3.插入数据库 db.session.add(obj) db.session.commit() return obj.id
def create(**kwargs): #1.获取参数信息 check_field_exists(Idc, kwargs) #2.传参个数验证 obj = Idc(**kwargs) db.session.add(obj) db.session.commit() return obj.id
def create(**kwargs): #1.获取参数信息 check_field_exists(IpInfo, kwargs) #2.传参个数验证 check_value_exists(Server, "id", kwargs.get("server_id", None)) check_value_exists(Switch, "id", kwargs.get("switch_id", None)) obj = IpInfo(**kwargs) #3.插入数据库 db.session.add(obj) db.session.commit() return obj.id
def create(**params): # 1. 获取参数信息 check_field_exists(Cabinet, params) print inspect.getmembers(Cabinet, predicate=inspect.ismethod(id)) # 传参的个数需要验证 obj = Cabinet(**params) # 插入到数据库 db.session.add(obj) db.session.commit() return obj.id
def create(**params): # 1. 获取参数信息 check_field_exists(Raidtype, params) print inspect.getmembers(Raidtype,predicate=inspect.ismethod(id)) # 传参的个数需要验证 obj = Raidtype(**params) # 插入到数据库 db.session.add(obj) db.session.commit() return obj.id
def create(**kwargs): # 1 获取用户传入参数 print kwargs # 2 验证参数的合法性 check_field_exists(Supplier, kwargs) # 3 插入到数据库 manufacturers = Supplier(**kwargs) db.session.add(manufacturers) try: db.session.commit() except Exception, e: current_app.logger.warning("commit error: {}".format(e.message)) raise Exception("commit error")
def create(**kwargs): # 1.获取参数信息 # return kwargs check_field_exists(Status,kwargs) # 传参的可个数验证 # 2.处理 # 3.通过数据实例化Status status = Status(**kwargs) # 4.插入到数据库 db.session.add(status) try: db.session.commit() except Exception, e: raise Exception(e.message.split(")")[1])
def create(**kwargs): # 1. 获取参数 # 2. 验证参数是否合法 check_field_exists(ServerType, kwargs) servertype = ServerType(**kwargs) db.session.add(servertype) try: db.session.commit() except Exception as e: current_app.logger.warning("插入错误: {} ".format(e.message)) raise Exception("commit error") # 3. 插入到数据库 # 4. 返回插入的状态 return servertype.id
def create(**kwargs): # 1. 获取参数 # 2. 验证参数是否合法 check_field_exists(ManagementCard, kwargs) managementcard = ManagementCard(**kwargs) db.session.add(managementcard) try: db.session.commit() except Exception as e: current_app.logger.warning("插入错误: {} ".format(e.message)) raise Exception("commit error") # 3. 插入到数据库 # 4. 返回插入的状态 return managementcard.id
def create(**kwargs): # 1. 获取参数 # 2. 验证参数是否合法 check_field_exists(Power, kwargs) power = Power(**kwargs) db.session.add(power) try: db.session.commit() except Exception as e: current_app.logger.warning("插入错误: {} ".format(e.message)) raise Exception("commit error") # 3. 插入到数据库 # 4. 返回插入的状态 return power.id
def create(**kwargs): # 1.获取参数信息 # return kwargs check_field_exists(Idc,kwargs) # 传参的可个数验证 # 2.处理 # 3.通过数据实例化Idc idc = Idc(**kwargs) # 4.插入到数据库 db.session.add(idc) try: db.session.commit() except Exception, e: raise Exception(e.message.split(")")[1])
def create(**kwargs): # 1 获取用户传入参数 print kwargs # 2 验证参数的合法性 check_field_exists(Cabinet, kwargs) # 3 插入到数据库 idc = Cabinet(**kwargs) db.session.add(idc) try: db.session.commit() except Exception, e: current_app.logger.warning("commit error: {}".format(e.message)) raise Exception("commit error")
def create(**kwargs): # 1 获取用户传入参数 print kwargs # 2 验证参数的合法性 check_field_exists(Product, kwargs) # 3 插入到数据库 idc = Product(**kwargs) db.session.add(idc) try: db.session.commit() except Exception, e: current_app.logger.warning("commit error: {}".format(e.message)) raise Exception("commit error")
def create(self, **kwargs): # 1. 获取参数 # 2. 验证参数是否合法 check_field_exists(self.Module, kwargs) idc = self.Module(**kwargs) db.session.add(idc) try: db.session.commit() except Exception as e: current_app.logger.warning("插入错误: {} ".format(e.message)) raise Exception("commit error") # 3. 插入到数据库 # 4. 返回插入的状态 return idc.id
def create(**kwargs): #1获取参数 check_field_exists(Server, kwargs) #2处理数据 #print inspect.getmembers(Server, predicate=inspect.is) #return 1 print kwargs #3实例化record record = Server(**kwargs) #4插入到数据库 db.session.add(record) try: db.session.commit() except Exception,e: raise Exception(e.message.split(") ")[1])
def create(**kwargs): # 1 获取参数 # print kwargs # 2 检查参数 check_field_exists(RaidType, kwargs) # 3 插入到数据库 raidtype = RaidType(**kwargs) db.session.add(raidtype) try: db.session.commit() except Exception, e: # logging current_app.logger.warning("commit error: {}".format(e.message)) raise Exception("commit error")
def create(**kwargs): #1获取参数 check_field_exists(Raid, kwargs) #2处理数据 #print inspect.getmembers(Raid, predicate=inspect.is) #return 1 print kwargs #3实例化record record = Raid(**kwargs) #4插入到数据库 db.session.add(record) try: db.session.commit() except Exception, e: raise Exception(e.message.split(") ")[1])
def create(**kwargs): # 1 获取参数 # print kwargs # 2 检查参数 check_field_exists(ManagementCard, kwargs) # 3 插入到数据库 managementcard = ManagementCard(**kwargs) db.session.add(managementcard) try: db.session.commit() except Exception, e: # logging current_app.logger.warning("commit error: {}".format(e.message)) raise Exception("commit error")
def create(**kwargs): #1获取参数 check_field_exists(Idc, kwargs) #2处理数据 #print inspect.getmembers(Idc, predicate=inspect.is) #return 1 print kwargs #3实例化idc idc = Idc(**kwargs) #4插入到数据库 db.session.add(idc) try: db.session.commit() except Exception,e: raise Exception(e.message.split(") ")[1])
def create(**params): # 1. 获取参数信息 check_field_exists(Idc, params) print inspect.getmembers(Idc,predicate=inspect.ismethod(id)) # 传参的个数需要验证 obj = Idc(**params) # 插入到数据库 db.session.add(obj) try: db.session.commit() except Exception,e: print e.message.split()[1] raise Exception(e.message.split(") ")[1])
def create(**params): # 1. 获取参数信息 check_field_exists(Status, params) print inspect.getmembers(Status,predicate=inspect.ismethod(id)) # 传参的个数需要验证 obj = Status(**params) # 插入到数据库 db.session.add(obj) try: db.session.commit() except Exception,e: print e.message.split()[1] raise Exception(e.message.split(") ")[1])
def create(**kwargs): # 1 获取参数 # print kwargs # 2 检查参数 check_field_exists(Manufacturers, kwargs) # 3 插入到数据库 manufacturers = Manufacturers(**kwargs) db.session.add(manufacturers) try: db.session.commit() except Exception, e: # logging current_app.logger.warning( "commit error: {}".format(e.message) ) raise Exception("commit error")
def create(**kwargs): # 1 获取参数 # print kwargs # 2 检查参数 check_field_exists(Product, kwargs) # 3 插入到数据库 product = Product(**kwargs) db.session.add(product) try: db.session.commit() except Exception, e: # logging current_app.logger.warning( "commit error: {}".format(e.message) ) raise Exception("commit error")
def create(**kwargs): # 1 获取参数 # print kwargs # 2 检查参数 check_field_exists(ServerType, kwargs) # 3 插入到数据库 servertype = ServerType(**kwargs) db.session.add(servertype) try: db.session.commit() except Exception, e: # logging current_app.logger.warning( "commit error: {}".format(e.message) ) raise Exception("commit error")
def create(**params): # 1. 获取参数信息 check_field_exists(Cabinet, params) check_value_exists(Idc,"id",params.get("idc_id",None)) check_value_exists(Power,"server_power",params.get("power",None)) print inspect.getmembers(Cabinet,predicate=inspect.ismethod(id)) # 传参的个数需要验证 obj = Cabinet(**params) # 插入到数据库 db.session.add(obj) try: db.session.commit() except Exception,e: print e.message.split()[1] raise Exception(e.message.split(") ")[1])
def create(**kwargs): check_field_exists(Status,kwargs) obj = Status(**kwargs) db.session.add(obj) db.session.commit() return obj.id
def create(**kwargs): check_field_exists(Power, kwargs) obj = Power(**kwargs) db.session.add(obj) db.session.commit() return obj.id
def create(**kwargs): check_field_exists(ServerType, kwargs) obj = ServerType(**kwargs) db.session.add(obj) db.session.commit() return obj.id
def create(**kwargs): check_field_exists(Idc,kwargs) obj = Idc(**kwargs) db.session.add(obj) db.session.commit() return obj.id
def create(**kwargs): check_field_exists(Ip_Info, kwargs) obj = Ip_Info(**kwargs) db.session.add(obj) db.session.commit() return obj.id
def create(**kwargs): check_field_exists(ServerType,kwargs) obj = ServerType(**kwargs) db.session.add(obj) db.session.commit() return obj.id
def create(**kwargs): check_field_exists(Manufacturers, kwargs) obj = Manufacturers(**kwargs) db.session.add(obj) db.session.commit() return obj.id
def create(**kwargs): check_field_exists(Status, kwargs) obj = Status(**kwargs) db.session.add(obj) db.session.commit() return obj.id
def create(**kwargs): check_field_exists(Cabinet,kwargs) obj = Cabinet(**kwargs) db.session.add(obj) db.session.commit() return obj.id
def create(**kwargs): check_field_exists(Raid,kwargs) obj = Raid(**kwargs) db.session.add(obj) db.session.commit() return obj.id
def create(**kwargs): check_field_exists(Supplier,kwargs) obj = Supplier(**kwargs) db.session.add(obj) db.session.commit() return obj.id