def _get_project_for_user(request, project_code):
    ' Check access, return (project, rw) tuple. '
    project = get_object_or_404(Project, code=project_code)
    if request.user.is_superuser:
        return (project, True)
    if (request.user.id == project.owner_id):
        return (project, True)
    membership = get_object_or_404(Member, project=project, user=request.user)
    return (project, membership.rw)
Check access, return (project, rw) tuple.
def _get_project_for_user(request, project_code):
    '  '
    project = get_object_or_404(Project, code=project_code)
    if request.user.is_superuser:
        return (project, True)
    if (request.user.id == project.owner_id):
        return (project, True)
    membership = get_object_or_404(Member, project=project, user=request.user)
    return (project, membership.rw)