checking for handler.anonymous in a safe way

This commit is contained in:
Jesper Noehr 2009-05-12 08:52:17 +02:00
Родитель 1d62dcdbd0
Коммит ee4110721f
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -63,7 +63,7 @@ class Resource(object):
that are different (OAuth stuff in `Authorization` header.) that are different (OAuth stuff in `Authorization` header.)
""" """
if not self.authentication.is_authenticated(request): if not self.authentication.is_authenticated(request):
if self.handler.anonymous and callable(self.handler.anonymous): if hasattr(self.handler, 'anonymous') and callable(self.handler.anonymous):
handler = self.handler.anonymous() handler = self.handler.anonymous()
anonymous = True anonymous = True
else: else: