X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/3204e4303148302d278036eebcfc8cb105cc97d7..2c6efebdedb5212749f1f6340118e31c22b260b1:/src/wiki/views.py?ds=sidebyside diff --git a/src/wiki/views.py b/src/wiki/views.py index 5dc770f7..17f7b73c 100644 --- a/src/wiki/views.py +++ b/src/wiki/views.py @@ -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)