+# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
from datetime import datetime
from functools import wraps
def default(self, obj):
if isinstance(obj, Promise):
- return unicode(obj)
+ return str(obj)
if isinstance(obj, datetime):
return datetime.ctime(obj) + " " + (datetime.tzname(obj) or 'GMT')
def ajax_login_required(view):
@wraps(view)
def authenticated_view(request, *args, **kwargs):
- if not request.user.is_authenticated():
+ if not request.user.is_authenticated:
return http.HttpResponse("Login required.", status=401, content_type="text/plain")
return view(request, *args, **kwargs)
return authenticated_view