def ensureProjectManager(cls, uid, pid): part = cls.getParticipation(uid, pid) part_roles = part.participationrole_set.all() ViewManager.ensureObjectExist(ParticipationRole, ErrorType.NotAProjManager, part_roles, role_id=Role.ProjectManagerId)
def ensureNoticeExist(cls, **args): return ViewManager.ensureObjectExist(Notice, ErrorType.NoticeNotExist, **args)
def ensureParticipationExist(cls, uid, pid): return ViewManager.ensureObjectExist(Participation, ErrorType.DoNotParticipated, user_id=uid, project_id=pid)
def ensureProjectExist(cls, **args): return ViewManager.ensureObjectExist(Project, ErrorType.ProjectNotExist, **args)
def ensureRoleExist(cls, rid): return ViewManager.ensureObjectExist(Role, ErrorType.RoleNotExist, id=rid)
def ensureTaskProgressExist(cls, **args): return ViewManager.ensureObjectExist(TaskProgress, ErrorType.ProgressReqNotExist, **args)
def ensureTaskTakeExist(cls, tid, uid): return ViewManager.ensureObjectExist(TaskTake, ErrorType.TaskTakeNotExist, task_id=tid, user_id=uid)
def ensureTaskExist(cls, **args): return ViewManager.ensureObjectExist(Task, ErrorType.TaskNotExist, **args)
def ensureFriendExist(cls, **args): return ViewManager.ensureObjectExist(Friend, ErrorType.NotAFriend, **args)
def ensureUserExist(cls, **args): return ViewManager.ensureObjectExist(User, ErrorType.UsernameExist, **args)