-# -*- 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
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
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
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
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)))
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)