Пример #1
0
    def check_uid(self, submit):
        uids = User.uids()
        if submit.__contains__("mainten_uid") and submit["mainten_uid"]:
            if submit["mainten_uid"] not in uids:
                raise ExceptionEx("不存在维护人 %s" % submit["mainten_uid"])

        if submit.__contains__("opt_uid") and submit["opt_uid"]:
            if submit["opt_uid"] not in uids:
                raise ExceptionEx("不存在业务人 %s" % submit["opt_uid"])
Пример #2
0
    def check_uid(self, submit):
        uids = User.uids()
        if submit.__contains__("mainten_uid") and submit["mainten_uid"]:
            if submit["mainten_uid"] not in uids:
                raise ExceptionEx("不存在维护人 %s" % submit["mainten_uid"])

        if submit.__contains__("opt_uid") and submit["opt_uid"]:
            if submit["opt_uid"] not in uids:
                raise ExceptionEx("不存在业务人 %s" % submit["opt_uid"])
Пример #3
0
    def add(_dict):
        from bmp.models.user import User

        if Project.query.filter(Project.name == _dict["name"]).count():
            raise ExceptionEx("项目名 %s 已存在" % _dict["name"])

        uids = User.uids()
        for uid in [_dict[u] for u in _dict if "_uid" in u]:
            if uid not in uids:
                raise ExceptionEx("用户 %s 不存在" % uid)

        proj = Project(_dict)
        db.session.add(proj)
        db.session.commit()
        return proj