Commit c9cb9439 authored by fred's avatar fred
Browse files

trivial: apply new pre-commit configuration

parent ea19914d
from django.contrib import admin from django.contrib import admin
from .models import Subscriber from .models import Subscriber
admin.site.register(Subscriber) admin.site.register(Subscriber)
from django import forms from django import forms
from .models import Subscriber, Newsletter
from .models import Newsletter, Subscriber
class SubscribeForm(forms.ModelForm): class SubscribeForm(forms.ModelForm):
......
# -*- coding: utf-8 -*-
from datetime import datetime
import time
import gzip import gzip
import xml.etree.ElementTree as ET
import os import os
import re import re
import urllib2 import time
from PIL import Image import xml.etree.ElementTree as ET
from datetime import datetime
from optparse import make_option from optparse import make_option
import urllib2
from django.conf import settings from django.conf import settings
from django.core.files import File from django.core.files import File
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from django.urls import reverse from django.urls import reverse
from django.utils.html import strip_tags from django.utils.html import strip_tags
from django.utils.text import slugify from django.utils.text import slugify
from PIL import Image
from ...models import Subscriber from ...models import Subscriber
class Author(object): class Author:
id_auteur = None id_auteur = None
email = None email = None
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import ckeditor.fields import ckeditor.fields
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-01-31 16:30 # Generated by Django 1.11.29 on 2021-01-31 16:30
from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-01-31 17:14 # Generated by Django 1.11.29 on 2021-01-31 17:14
from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-01-31 17:21 # Generated by Django 1.11.29 on 2021-01-31 17:21
from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-01-31 19:13 # Generated by Django 1.11.29 on 2021-01-31 19:13
from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
......
...@@ -3,26 +3,21 @@ import hashlib ...@@ -3,26 +3,21 @@ import hashlib
import random import random
import smtplib import smtplib
import subprocess import subprocess
from email.mime.multipart import MIMEMultipart from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText from email.mime.text import MIMEText
import html2text import html2text
from ckeditor.fields import RichTextField
from django.db import models, IntegrityError from django.conf import settings
from django.urls import reverse from django.core.mail import send_mail
from django.db import IntegrityError, models
from django.template import loader from django.template import loader
from django.template.loader import render_to_string from django.template.loader import render_to_string
from django.conf import settings from django.urls import reverse
from django.utils.encoding import force_bytes from django.utils.encoding import force_bytes
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.translation import ugettext from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.core.mail import send_mail
from ckeditor.fields import RichTextField
class Subscriber(models.Model): class Subscriber(models.Model):
......
from django.conf.urls import url
from django.conf import settings from django.conf import settings
from django.conf.urls import url
from .views import ( from .views import (
subscribe,
thanks,
confirmation, confirmation,
stats,
newsletter_list,
newsletter_create, newsletter_create,
newsletter_view, newsletter_list,
newsletter_update,
newsletter_send, newsletter_send,
newsletter_update,
newsletter_view,
stats,
subscribe,
thanks,
) )
urlpatterns = [ urlpatterns = [
......
import datetime
import email import email
import hashlib import hashlib
import random import random
import socket import socket
import datetime
import django.utils.six.moves.http_cookiejar as cookielib
import django.utils.six.moves.urllib as urllib2
from django.conf import settings from django.conf import settings
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.urls import reverse_lazy from django.db import IntegrityError, models
from django.db import models, IntegrityError from django.http import HttpResponseRedirect, JsonResponse
from django.http import JsonResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.urls import reverse_lazy
from django.utils.http import urlencode from django.utils.http import urlencode
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
import django.utils.six.moves.urllib as urllib2 from django.views.decorators.csrf import csrf_exempt
import django.utils.six.moves.http_cookiejar as cookielib from django.views.generic.base import RedirectView, TemplateView
from django.views.generic.base import TemplateView, RedirectView
from django.views.generic.detail import DetailView from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from django.views.generic.edit import CreateView, UpdateView from django.views.generic.edit import CreateView, UpdateView
from django.views.decorators.csrf import csrf_exempt from django.views.generic.list import ListView
from .forms import SubscribeForm, NewsletterForm from .forms import NewsletterForm, SubscribeForm
from .models import Subscriber, Newsletter from .models import Newsletter, Subscriber
class SubscribeView(CreateView): class SubscribeView(CreateView):
...@@ -63,7 +62,7 @@ class ConfirmationView(TemplateView): ...@@ -63,7 +62,7 @@ class ConfirmationView(TemplateView):
template_name = 'newsletter/done.html' template_name = 'newsletter/done.html'
def get_context_data(self, token, **kwargs): def get_context_data(self, token, **kwargs):
context = super(ConfirmationView, self).get_context_data(**kwargs) context = super().get_context_data(**kwargs)
subscriber = get_object_or_404(Subscriber, password=token, is_validated=False) subscriber = get_object_or_404(Subscriber, password=token, is_validated=False)
subscriber.is_validated = True subscriber.is_validated = True
subscriber.save() subscriber.save()
...@@ -82,10 +81,10 @@ class NewsletterCreateView(CreateView): ...@@ -82,10 +81,10 @@ class NewsletterCreateView(CreateView):
def get_form(self, *args, **kwargs): def get_form(self, *args, **kwargs):
if not self.request.user.has_perm('newsletter.add_newsletter'): if not self.request.user.has_perm('newsletter.add_newsletter'):
raise PermissionDenied() raise PermissionDenied()
return super(NewsletterCreateView, self).get_form(*args, **kwargs) return super().get_form(*args, **kwargs)
def get_initial(self): def get_initial(self):
initial = super(NewsletterCreateView, self).get_initial() initial = super().get_initial()
initial['date'] = datetime.datetime.today() initial['date'] = datetime.datetime.today()
return initial return initial
...@@ -114,7 +113,7 @@ class NewsletterUpdateView(UpdateView): ...@@ -114,7 +113,7 @@ class NewsletterUpdateView(UpdateView):
def get_form(self, *args, **kwargs): def get_form(self, *args, **kwargs):
if not self.request.user.has_perm('newsletter.add_newsletter'): if not self.request.user.has_perm('newsletter.add_newsletter'):
raise PermissionDenied() raise PermissionDenied()
return super(NewsletterUpdateView, self).get_form(*args, **kwargs) return super().get_form(*args, **kwargs)
newsletter_update = NewsletterUpdateView.as_view() newsletter_update = NewsletterUpdateView.as_view()
......
#! /usr/bin/env python #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os import os
import subprocess import subprocess
import sys import sys
from distutils.cmd import Command
from setuptools.command.install_lib import install_lib as _install_lib
from distutils.command.build import build as _build from distutils.command.build import build as _build
from distutils.command.sdist import sdist as _sdist from distutils.command.sdist import sdist as _sdist
from distutils.cmd import Command
from setuptools import setup, find_packages from setuptools import find_packages, setup
from setuptools.command.install_lib import install_lib as _install_lib
class sdist(_sdist): class sdist(_sdist):
...@@ -26,7 +25,7 @@ class sdist(_sdist): ...@@ -26,7 +25,7 @@ class sdist(_sdist):
def get_version(): def get_version():
if os.path.exists('VERSION'): if os.path.exists('VERSION'):
with open('VERSION', 'r') as v: with open('VERSION') as v:
return v.read() return v.read()
if os.path.exists('.git'): if os.path.exists('.git'):
p = subprocess.Popen( p = subprocess.Popen(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment