Inventory.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:QXSConsolas 作者: qxsch 项目源码 文件源码
def updateAttributes(self, object_id=None, object_name=None, object_subname=None, **kwargs):
        assert not (object_id is None and object_name is None and object_subname is None), "At least one identifier must be set"
        if object_id is None:
            if object_subname is None:
                object_id = self.getObjectIdByName(object_name)
            else:
                object_id = self.getObjectIdByName(object_name, object_subname)
        else:
            self.getObjectId(object_id)
        self._validateAttributes(kwargs, checkMandatoryAttrs=False)
        for k in kwargs:
            if self.attributeExists(object_id, k):
                self._connection.execute(md.InventoryObjectAttributes.update().where(and_(md.InventoryObjectAttributes.c.class_id == self._classId, md.InventoryObjectAttributes.c.object_id == object_id, md.InventoryObjectAttributes.c.attr_key == k)).values(attr_value=str(kwargs[k])))
            else:
                self._connection.execute(md.InventoryObjectAttributes.insert().values(object_id=object_id, class_id=self._classId, attr_key=str(k), attr_value=str(kwargs[k])))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号