X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/f982c8513663a0f9927fb04ba650a5f63bb7f21f..d102074ede069e26e5f7ce3deb3a5bd096cc41b5:/forum/modules/ui_objects.py?ds=sidebyside diff --git a/forum/modules/ui_objects.py b/forum/modules/ui_objects.py index 7fcf96c..e42c940 100644 --- a/forum/modules/ui_objects.py +++ b/forum/modules/ui_objects.py @@ -2,6 +2,7 @@ from django.core.urlresolvers import reverse from django.template.defaultfilters import slugify from django import template from forum.utils import html +from forum.models.user import AnonymousUser from ui import Registry from copy import copy @@ -62,7 +63,7 @@ class ObjectBase(object): def __call__(self, context): if callable(self.argument): - user = context.get('request', None) and context['request'].user or None + user = context.get('request', None) and context['request'].user or AnonymousUser() return self.argument(user, context) else: return self.argument @@ -78,7 +79,10 @@ class ObjectBase(object): try: return self._visible_to(context['request'].user) except KeyError: - return True + try: + return self._visible_to(context['viewer']) + except KeyError: + return self._visible_to(AnonymousUser()) def render(self, context): return ''