upgrade fnpdjango
authorJan Szejko <janek37@gmail.com>
Tue, 10 Jul 2018 12:54:06 +0000 (14:54 +0200)
committerJan Szejko <janek37@gmail.com>
Tue, 10 Jul 2018 12:54:06 +0000 (14:54 +0200)
requirements/requirements.txt
src/catalogue/fields.py
src/catalogue/models/bookmedia.py
src/catalogue/models/tag.py
src/catalogue/test_utils.py
src/funding/utils.py
src/isbn/forms.py
src/picture/models.py
src/sortify.py

index 631f473..20c7c97 100644 (file)
@@ -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
index 92e8de4..378377c 100644 (file)
@@ -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
index 6b65080..377dbc4 100644 (file)
@@ -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)
index 830f29f..7e15636 100644 (file)
@@ -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
index 497b995..18c5674 100644 (file)
@@ -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 {
index 77d8981..5808336 100644 (file)
@@ -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,
index 558cd9a..2acc34a 100644 (file)
@@ -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 = {
index 455ed10..643149a 100644 (file)
@@ -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)
index f1e8bcb..61cb9d8 100644 (file)
@@ -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.