X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/5913c54d19b8f6775633176032161d49f9b2f1aa..df341bdd09208d2b0f84060454cc0000df19deba:/src/wiki/helpers.py?ds=sidebyside diff --git a/src/wiki/helpers.py b/src/wiki/helpers.py index 877a9d0e..9b1b3273 100644 --- a/src/wiki/helpers.py +++ b/src/wiki/helpers.py @@ -1,3 +1,6 @@ +# 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 @@ -10,7 +13,7 @@ class ExtendedEncoder(json.JSONEncoder): 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') @@ -44,7 +47,7 @@ class JSONServerError(JSONResponse): 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