Showing <animacja>.
[redakcja.git] / src / wiki / views.py
index 5dc770f..17f7b73 100644 (file)
@@ -1,4 +1,6 @@
-# -*- coding: utf-8 -*-
+# 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
 import os
 import logging
@@ -6,7 +8,7 @@ from time import mktime
 from urllib.parse import quote
 
 from django.conf import settings
-from django.core.urlresolvers import reverse
+from django.urls import reverse
 from django import http
 from django.http import Http404, HttpResponseForbidden
 from django.middleware.gzip import GZipMiddleware
@@ -115,7 +117,7 @@ def text(request, chunk_id):
     if request.method == 'POST':
         form = forms.DocumentTextSaveForm(request.POST, user=request.user, prefix="textsave")
         if form.is_valid():
-            if request.user.is_authenticated():
+            if request.user.is_authenticated:
                 author = request.user
             else:
                 author = None
@@ -180,7 +182,7 @@ def revert(request, chunk_id):
         comment = form.cleaned_data['comment']
         comment += "\n#revert to %s" % revision
 
-        if request.user.is_authenticated():
+        if request.user.is_authenticated:
             author = request.user
         else:
             author = None
@@ -206,10 +208,10 @@ def gallery(request, directory):
                         settings.IMAGE_DIR,
                         directory))
 
-        base_dir = os.path.join((
+        base_dir = os.path.join(
                     settings.MEDIA_ROOT,
                     settings.IMAGE_DIR,
-                    directory))
+                    directory)
 
         def map_to_url(filename):
             return quote(("%s/%s" % (base_url, filename)))
@@ -222,7 +224,7 @@ def gallery(request, directory):
 
         books = Book.objects.filter(gallery=directory)
 
-        if not all(book.public for book in books) and not request.user.is_authenticated():
+        if not all(book.public for book in books) and not request.user.is_authenticated:
             return HttpResponseForbidden("Not authorized.")
 
         return JSONResponse(images)