def put(self, aid): submit = self.request() access = Access.get(aid) if access["status"] != ACCESS.APPROVAL: raise ExceptionEx("申请未提交") submit["approval_uid"] = session.get_uid() submit["approval_time"] = datetime.now() submit["id"] = aid Access.edit(submit) return self.succ()
def put(self, aid): submit = self.request() submit["id"] = aid if submit.__contains__("content"): submit["content"] = json.dumps(submit["content"]) access = Access.edit(submit, auto_commit=False) if submit["status"] == ACCESS.APPROVAL: mail = Mail() if not mail.to(access): raise ExceptionEx("邮件发送失败") db.session.commit() return self.succ()