def list_projects(request): reg_projects = RegisteredProjects() project_list = list() errors = list() for project in reg_projects.get_list(): try: project['id'] = int(project['id']) project['status_cls'] = map_text_cls(project['status']) project['location'] = project['path'] if len(project['location']) > MAX_LOCATION_CHARS: project['location'] = '...' + \ project['location'][MAX_LOCATION_CHARS - 3:] except BrainyProjectError as project_error: # Report error endowed with the project. errors.append({ 'msg': str(project_error), 'project': project, }) continue project_list.append(project) context = { 'error_list': errors, 'project_list': project_list, } return render(request, 'projects/list.tpl', context)