fix problems with permissions

This commit is contained in:
Kamil Gałuszka 2015-01-06 18:29:29 +01:00
parent d61b9922ce
commit 84ae23b903

View file

@ -344,6 +344,12 @@ class TemplatePermissionChecker(object):
def __nonzero__(self):
# if no view is bound we will return false, since we don't know which
# permission to check we stay save in disallowing the access
return self._cast_bool()
def __bool__(self):
return self._cast_bool()
def _cast_bool(self):
if self._view is None:
return False
if self._obj is None:
@ -351,6 +357,7 @@ class TemplatePermissionChecker(object):
else:
return self._view.has_permission(self._obj)
def __str__(self):
if self._view is None:
return ''