Mercurial > public > sg101
diff gpp/forums/views/subscriptions.py @ 459:9d3bd7304050
Fixing #221. Also combined all permissions checks into a new module, permissions.py. This allows us to cache user, category, and forum groups information since it rarely changes.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 02 Jul 2011 23:35:45 +0000 |
parents | 9fcd366f22dc |
children | 82b97697312e |
line wrap: on
line diff
--- a/gpp/forums/views/subscriptions.py Sat Jul 02 03:52:43 2011 +0000 +++ b/gpp/forums/views/subscriptions.py Sat Jul 02 23:35:45 2011 +0000 @@ -13,6 +13,7 @@ from django.views.decorators.http import require_POST from forums.models import Topic +import forums.permissions as perms from core.functions import send_mail from core.paginator import DiggPaginator @@ -50,7 +51,7 @@ def subscribe_topic(request, topic_id): """Subscribe the user to the requested topic.""" topic = get_object_or_404(Topic.objects.select_related(), id=topic_id) - if topic.forum.category.can_access(request.user): + if perms.can_access(topic.forum.category, request.user): topic.subscribers.add(request.user) return HttpResponseRedirect( reverse("forums-subscription_status", args=[topic.id]))