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

    @functools.wraps(f)
    def wrapper(request, slug, **kwargs):
        tlk = get_object_or_404(models.Talk, slug=slug)
        if request.user.is_anonymous():
            full_access = False
        elif request.user.is_staff:
            full_access = True
        else:
            try:
                tlk.get_all_speakers().get(user__id=request.user.id)
            except (models.Speaker.DoesNotExist, models.Speaker.MultipleObjectsReturned):
                full_access = False
            else:
                full_access = True
        if ((tlk.status == 'proposed') and (not full_access)):
            conf = models.Conference.objects.current()
            if (not settings.VOTING_OPENED(conf, request.user)):
                return http.HttpResponseForbidden()
            if (not settings.VOTING_ALLOWED(request.user)):
                if settings.VOTING_DISALLOWED:
                    return redirect(settings.VOTING_DISALLOWED)
                else:
                    return http.HttpResponseForbidden()
        return f(request, slug, talk=tlk, full_access=full_access, **kwargs)
    return wrapper
Decorator that protects the view relative to a talk.
def talk_access(f):
    '\n    \n    '

    @functools.wraps(f)
    def wrapper(request, slug, **kwargs):
        tlk = get_object_or_404(models.Talk, slug=slug)
        if request.user.is_anonymous():
            full_access = False
        elif request.user.is_staff:
            full_access = True
        else:
            try:
                tlk.get_all_speakers().get(user__id=request.user.id)
            except (models.Speaker.DoesNotExist, models.Speaker.MultipleObjectsReturned):
                full_access = False
            else:
                full_access = True
        if ((tlk.status == 'proposed') and (not full_access)):
            conf = models.Conference.objects.current()
            if (not settings.VOTING_OPENED(conf, request.user)):
                return http.HttpResponseForbidden()
            if (not settings.VOTING_ALLOWED(request.user)):
                if settings.VOTING_DISALLOWED:
                    return redirect(settings.VOTING_DISALLOWED)
                else:
                    return http.HttpResponseForbidden()
        return f(request, slug, talk=tlk, full_access=full_access, **kwargs)
    return wrapper