示例#1
0
 def add(self, user):
     """
     增加用户
     :param id:
     :return:
     """
     dbSession.add(user)
     return True
 def saveReport(self, report):
     try:
         dbSession.add(report)
         dbSession.commit()
         return 1
     except Exception as e:
         dbSession.rollback()
         app.logger.info(e.args.__str__())
         return 0
示例#3
0
 def add(self, data):
     """
     添加
     :param data:
     :return:
     """
     log = Log(**data)
     dbSession.add(log)
     dbSession.flush()
     return log.id
示例#4
0
 def add(self, cls_, data: dict) -> int:
     """
     添加
     :param cls_: 数据库模型实体类
     :param data:  数据
     :return:  bool
     """
     user = cls_(**data)
     dbSession.add(user)
     dbSession.flush()
     return user.id
示例#5
0
 def add(index, uuid, imgString):
     """
     增加分片数据
     :param index:
     :param uuid:
     :param imgString:
     :return:
     """
     data = ImgShard(index=index, uuid=uuid, imgString=imgString)
     dbSession.add(data)
     return dbSession.commit()
示例#6
0
def create():
    """ Da de alta un centro en la base de datos."""
    form = CreateCenterForm()
    app.logger.info(form.data)
    if form.validate():
        center = Center()
        form.populate_obj(center)
        center.protocol = request.files['protocol'].read()
        dbSession.add(center)
        dbSession.commit()
    if form.errors:
        display_errors(form.errors)
        return redirect(url_for("center_new"))
    return redirect(url_for("center_index", page=1))
 def add(self, data, type=1, level=1):
     """
     添加
     :param data:
     :param type:
     :param level:
     :return:
     """
     data_dict = {
         'data': data,
         'type': type,
         'level': level,
         'create_time': int(time.time())
     }
     try:
         log = HotLog(**data_dict)
         dbSession.add(log)
         dbSession.flush()
         id = log.id
         dbSession.commit()
         return id
     except Exception as e:
         dbSession.rollback()
         return 0
示例#8
0
 def putJob(self, job):
     try:
         dbSession.add(job)
         dbSession.commit()
     except Exception as e:
         app.logger.info("ERROR:ServiceJob.putJob():" + e.args.__str__())