Пример #1
0
    def get_project(user, project_id):
        """Get user cached project."""
        try:
            record = Project.get((Project.project_id == project_id)
                                 & (Project.user_id == user.user_id))
        except ValueError:
            return

        return record
Пример #2
0
    def get_project(user, project_id):
        """Get user cached project."""
        try:
            record = Project.get((Project.project_id == project_id) & (Project.user_id == user.user_id))
        except ValueError:
            raise ProjectNotFound(project_id)

        if not record.abs_path.exists():
            record.delete()
            raise ProjectNotFound(project_id)

        return record