From 538526fc82b771cbc149743f129d8b1ae7e3cba2 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Tue, 10 Jul 2018 14:54:06 +0200 Subject: [PATCH] upgrade fnpdjango --- requirements/requirements.txt | 2 +- src/catalogue/fields.py | 4 ++-- src/catalogue/models/bookmedia.py | 6 +++--- src/catalogue/models/tag.py | 4 ++-- src/catalogue/test_utils.py | 4 ++-- src/funding/utils.py | 2 +- src/isbn/forms.py | 4 ++-- src/picture/models.py | 6 +++--- src/sortify.py | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 631f473f0..20c7c97df 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -2,7 +2,7 @@ # django Django>=1.8,<1.9 -fnpdjango>=0.1.15,<0.2 +fnpdjango>=0.2.8,<0.3 django-pipeline>=1.6,<1.7 jsmin fnp-django-pagination diff --git a/src/catalogue/fields.py b/src/catalogue/fields.py index 92e8de48c..378377ced 100644 --- a/src/catalogue/fields.py +++ b/src/catalogue/fields.py @@ -163,7 +163,7 @@ class BuildMobi(BuildEbook): class BuildHtml(BuildEbook): def build(self, fieldfile): from django.core.files.base import ContentFile - from fnpdjango.utils.text.slughifi import slughifi + from slugify import slugify from sortify import sortify from librarian import html from catalogue.models import Fragment, Tag @@ -204,7 +204,7 @@ class BuildHtml(BuildEbook): if lang == settings.LANGUAGE_CODE: # Allow creating themes if book in default language. tag, created = Tag.objects.get_or_create( - slug=slughifi(theme_name), + slug=slugify(theme_name), category='theme') if created: tag.name = theme_name diff --git a/src/catalogue/models/bookmedia.py b/src/catalogue/models/bookmedia.py index 6b650806c..377dbc43c 100644 --- a/src/catalogue/models/bookmedia.py +++ b/src/catalogue/models/bookmedia.py @@ -8,14 +8,14 @@ from collections import namedtuple from django.db import models from django.utils.translation import ugettext_lazy as _ import jsonfield -from fnpdjango.utils.text.slughifi import slughifi +from slugify import slugify from mutagen import MutagenError from catalogue.fields import OverwriteStorage def _file_upload_to(i, _n): - return 'book/%(ext)s/%(name)s.%(ext)s' % {'ext': i.ext(), 'name': slughifi(i.name)} + return 'book/%(ext)s/%(name)s.%(ext)s' % {'ext': i.ext(), 'name': slugify(i.name)} class BookMedia(models.Model): @@ -66,7 +66,7 @@ class BookMedia(models.Model): old = None else: # if name changed, change the file name, too - if slughifi(self.name) != slughifi(old.name): + if slugify(self.name) != slugify(old.name): self.file.save(None, ExistingFile(self.file.path), save=False) super(BookMedia, self).save(*args, **kwargs) diff --git a/src/catalogue/models/tag.py b/src/catalogue/models/tag.py index 830f29f69..7e15636da 100644 --- a/src/catalogue/models/tag.py +++ b/src/catalogue/models/tag.py @@ -230,7 +230,7 @@ class Tag(TagBase): @staticmethod def tags_from_info(info): - from fnpdjango.utils.text.slughifi import slughifi + from slugify import slugify from sortify import sortify meta_tags = [] categories = (('kinds', 'kind'), ('genres', 'genre'), ('authors', 'author'), ('epochs', 'epoch')) @@ -251,7 +251,7 @@ class Tag(TagBase): tag_name = tag_name.readable() if lang == settings.LANGUAGE_CODE: # Allow creating new tag, if it's in default language. - tag, created = Tag.objects.get_or_create(slug=slughifi(tag_name), category=category) + tag, created = Tag.objects.get_or_create(slug=slugify(tag_name), category=category) if created: tag_name = unicode(tag_name) tag.name = tag_name diff --git a/src/catalogue/test_utils.py b/src/catalogue/test_utils.py index 497b99545..18c567406 100644 --- a/src/catalogue/test_utils.py +++ b/src/catalogue/test_utils.py @@ -7,7 +7,7 @@ import tempfile from traceback import extract_stack from django.test import TestCase from django.test.utils import override_settings -from fnpdjango.utils.text.slughifi import slughifi +from slugify import slugify from librarian import WLURI from django.conf import settings @@ -72,7 +72,7 @@ class BookInfoStub(object): def info_args(title, language=None): """ generate some keywords for comfortable BookInfoCreation """ - slug = unicode(slughifi(title)) + slug = unicode(slugify(title)) if language is None: language = u'pol' return { diff --git a/src/funding/utils.py b/src/funding/utils.py index 77d8981f5..580833699 100644 --- a/src/funding/utils.py +++ b/src/funding/utils.py @@ -4,7 +4,7 @@ # import re import string -from fnpdjango.utils.text.slughifi import char_map +from fnpdjango.utils.text import char_map # PayU chokes on non-Polish diacritics. # Punctuation is handled correctly and escaped as needed, diff --git a/src/isbn/forms.py b/src/isbn/forms.py index 558cd9aa0..2acc34a8e 100644 --- a/src/isbn/forms.py +++ b/src/isbn/forms.py @@ -4,7 +4,7 @@ from urllib2 import urlopen from django import forms from django.utils.translation import ugettext_lazy as _ -from fnpdjango.utils.text.slughifi import slughifi +from slugify import slugify from isbn.management.commands.import_onix import UNKNOWN from isbn.models import ONIXRecord, ISBNPool @@ -86,7 +86,7 @@ class FNPISBNForm(forms.Form): return {'role': 'A01', 'name': output_name} def slug(self): - return slughifi('fnp %s %s' % (self.cleaned_data['authors'], self.cleaned_data['title'])) + return slugify('fnp %s %s' % (self.cleaned_data['authors'], self.cleaned_data['title'])) def save(self): data = { diff --git a/src/picture/models.py b/src/picture/models.py index 455ed10f4..643149a1a 100644 --- a/src/picture/models.py +++ b/src/picture/models.py @@ -10,7 +10,7 @@ from django.conf import settings from django.contrib.contenttypes.fields import GenericRelation from django.core.files.storage import FileSystemStorage from django.utils.datastructures import SortedDict -from fnpdjango.utils.text.slughifi import slughifi +from slugify import slugify from ssify import flush_ssi_includes from catalogue.models.tag import prefetched_relations @@ -224,7 +224,7 @@ class Picture(models.Model): # str.capitalize() is wrong, because it also lowers letters objname = objname[0].upper() + objname[1:] tag, created = catalogue.models.Tag.objects.get_or_create( - slug=slughifi(objname), category='thing') + slug=slugify(objname), category='thing') if created: tag.name = objname setattr(tag, 'name_%s' % lang, tag.name) @@ -249,7 +249,7 @@ class Picture(models.Model): for motifs in part['themes']: for motif in motifs.split(','): tag, created = catalogue.models.Tag.objects.get_or_create( - slug=slughifi(motif), category='theme') + slug=slugify(motif), category='theme') if created: tag.name = motif tag.sort_key = sortify(tag.name) diff --git a/src/sortify.py b/src/sortify.py index f1e8bcb8b..61cb9d892 100644 --- a/src/sortify.py +++ b/src/sortify.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- import re -from fnpdjango.utils.text.slughifi import char_map +from fnpdjango.utils.text import char_map # Specifies diacritics order. -- 2.20.1