# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from django.urls import reverse
+import ckeditor.views
+import ckeditor.widgets
+from ckeditor.image import pillow_backend
from django.forms.utils import flatatt
from django.template.loader import render_to_string
+from django.urls import reverse
from django.utils.encoding import force_text
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
from django.utils.translation import get_language
-import ckeditor.views
-import ckeditor.widgets
-from ckeditor.image import pillow_backend
-
def ckeditor_render(self, name, value, attrs=None, renderer=None):
if value is None:
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from django.conf import settings
-
import ckeditor.fields
+from django.conf import settings
class RichTextField(ckeditor.fields.RichTextField):
'external_plugin_resources': self.external_plugin_resources,
}
defaults.update(kwargs)
- return super(RichTextField, self).formfield(**defaults)
+ return super().formfield(**defaults)
class RichTextFormField(ckeditor.fields.RichTextFormField):
def clean(self, value):
- value = super(RichTextFormField, self).clean(value)
+ value = super().clean(value)
if settings.LANGUAGE_CODE.startswith('fr-'):
# apply some basic typographic rules
value = value.replace('« ', '«\u202f')
-# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-12-29 13:29
-from __future__ import unicode_literals
-import chloro.phyll.fields
-from django.db import migrations, models
import taggit.managers
+from django.db import migrations, models
+
+import chloro.phyll.fields
class Migration(migrations.Migration):
-# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-12-29 18:32
-from __future__ import unicode_literals
from django.db import migrations
-# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-12-29 18:39
-from __future__ import unicode_literals
from django.db import migrations, models
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import ckeditor.views as ckeditor_views
from django.conf.urls import url
from django.contrib.admin.views.decorators import staff_member_required
from django.views.decorators.cache import never_cache
-import ckeditor.views as ckeditor_views
-
from . import views
urlpatterns = [
from django.contrib.syndication.views import Feed
from django.core.exceptions import PermissionDenied
from django.core.files.storage import default_storage
-from django.http import HttpResponse, Http404, JsonResponse
+from django.http import Http404, HttpResponse, JsonResponse
from django.utils.feedgenerator import Atom1Feed
from django.utils.text import slugify
from django.views import View
from django.views.decorators.csrf import csrf_exempt
-from django.views.generic import CreateView, DeleteView, DetailView, ListView, UpdateView, TemplateView
-
+from django.views.generic import CreateView, DeleteView, DetailView, ListView, TemplateView, UpdateView
from sorl.thumbnail.shortcuts import get_thumbnail
from .models import Note
raise Http404()
if not note.published and not request.user.is_staff:
raise PermissionDenied()
- return super(NoteView, self).get(request, *args, **kwargs)
+ return super().get(request, *args, **kwargs)
class NoteEditView(UpdateView):
template_name = 'phyll/home.html'
def get_context_data(self, **kwargs):
- context = super(HomeView, self).get_context_data(**kwargs)
+ context = super().get_context_data(**kwargs)
context['posts'] = Note.objects.filter(published=True).order_by('-creation_timestamp')[:5]
context['recent_changes'] = Note.objects.filter(published=True).order_by('-last_update_timestamp')
return context
model = Note
def get_queryset(self):
- qs = super(ArchivesView, self).get_queryset()
+ qs = super().get_queryset()
if not self.request.user.is_staff:
qs = qs.filter(published=True)
return qs
class Atom1FeedWithBaseXml(Atom1Feed):
def root_attributes(self):
- root_attributes = super(Atom1FeedWithBaseXml, self).root_attributes()
+ root_attributes = super().root_attributes()
scheme, netloc, path, params, query, fragment = urllib.parse.urlparse(self.feed['feed_url'])
root_attributes['xml:base'] = urllib.parse.urlunparse((scheme, netloc, '/', params, query, fragment))
return root_attributes
def get_object(self, request, *args, **kwargs):
self.sub = kwargs.get('sub', 'default')
- return super(AtomFeed, self).get_object(request, *args, **kwargs)
+ return super().get_object(request, *args, **kwargs)
def items(self):
qs = Note.objects.filter(published=True)
python3-all,
python3-django,
python3-setuptools,
- sassc
+ sassc,
Standards-Version: 3.9.1
Package: chloro
#! /usr/bin/env python3
-# -*- coding: utf-8 -*-
import os
import re
import subprocess
import sys
-
-from setuptools.command.install_lib import install_lib as _install_lib
+from distutils.cmd import Command
from distutils.command.build import build as _build
from distutils.command.sdist import sdist
-from distutils.cmd import Command
from distutils.spawn import find_executable
-from setuptools import setup, find_packages
+
+from setuptools import find_packages, setup
+from setuptools.command.install_lib import install_lib as _install_lib
class eo_sdist(sdist):
tag exists, take 0.0- and add the length of the commit log.
"""
if os.path.exists('VERSION'):
- with open('VERSION', 'r') as v:
+ with open('VERSION') as v:
return v.read()
if os.path.exists('.git'):
p = subprocess.Popen(