def speaker_access(f):
    '\n    Decorator that protects the view relative to a speaker.\n    '

    @functools.wraps(f)
    def wrapper(request, slug, **kwargs):
        spk = get_object_or_404(models.Speaker, slug=slug)
        if (request.user.is_staff or (request.user == spk.user)):
            full_access = True
            talks = spk.talks()
        else:
            full_access = False
            conf = models.Conference.objects.current()
            if settings.VOTING_OPENED(conf, request.user):
                if settings.VOTING_ALLOWED(request.user):
                    talks = spk.talks()
                elif settings.VOTING_DISALLOWED:
                    return redirect(settings.VOTING_DISALLOWED)
                else:
                    raise http.Http404()
            else:
                talks = spk.talks(status='accepted')
                if (talks.count() == 0):
                    raise http.Http404()
        return f(request, slug, speaker=spk, talks=talks, full_access=full_access, **kwargs)
    return wrapper
Decorator that protects the view relative to a speaker.
def speaker_access(f):
    '\n    \n    '

    @functools.wraps(f)
    def wrapper(request, slug, **kwargs):
        spk = get_object_or_404(models.Speaker, slug=slug)
        if (request.user.is_staff or (request.user == spk.user)):
            full_access = True
            talks = spk.talks()
        else:
            full_access = False
            conf = models.Conference.objects.current()
            if settings.VOTING_OPENED(conf, request.user):
                if settings.VOTING_ALLOWED(request.user):
                    talks = spk.talks()
                elif settings.VOTING_DISALLOWED:
                    return redirect(settings.VOTING_DISALLOWED)
                else:
                    raise http.Http404()
            else:
                talks = spk.talks(status='accepted')
                if (talks.count() == 0):
                    raise http.Http404()
        return f(request, slug, speaker=spk, talks=talks, full_access=full_access, **kwargs)
    return wrapper