def profile_access(f):
    '\n    Decorator which protect the relative view to a profile.\n    '

    @functools.wraps(f)
    def wrapper(request, slug, **kwargs):
        try:
            profile = models.AttendeeProfile.objects.select_related('user').get(slug=slug)
        except models.AttendeeProfile.DoesNotExist:
            raise http.Http404()
        if (request.user.is_staff or (request.user == profile.user)):
            full_access = True
        else:
            full_access = False
            accepted = models.TalkSpeaker.objects.filter(speaker__user=profile.user).filter(talk__status='accepted').count()
            if (not accepted):
                conf = models.Conference.objects.current()
                if (not (settings.VOTING_OPENED(conf, request.user) and settings.VOTING_ALLOWED(request.user))):
                    if (profile.visibility == 'x'):
                        return http.HttpResponseForbidden()
                    elif ((profile.visibility == 'm') and request.user.is_anonymous()):
                        return http.HttpResponseForbidden()
        return f(request, slug, profile=profile, full_access=full_access, **kwargs)
    return wrapper
Decorator which protect the relative view to a profile.
def profile_access(f):
    '\n    \n    '

    @functools.wraps(f)
    def wrapper(request, slug, **kwargs):
        try:
            profile = models.AttendeeProfile.objects.select_related('user').get(slug=slug)
        except models.AttendeeProfile.DoesNotExist:
            raise http.Http404()
        if (request.user.is_staff or (request.user == profile.user)):
            full_access = True
        else:
            full_access = False
            accepted = models.TalkSpeaker.objects.filter(speaker__user=profile.user).filter(talk__status='accepted').count()
            if (not accepted):
                conf = models.Conference.objects.current()
                if (not (settings.VOTING_OPENED(conf, request.user) and settings.VOTING_ALLOWED(request.user))):
                    if (profile.visibility == 'x'):
                        return http.HttpResponseForbidden()
                    elif ((profile.visibility == 'm') and request.user.is_anonymous()):
                        return http.HttpResponseForbidden()
        return f(request, slug, profile=profile, full_access=full_access, **kwargs)
    return wrapper