From 63519710f7ae064e26d3ee068d59201e8bc02cf3 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 19 Mar 2015 16:20:10 +0100 Subject: [PATCH] Upgrate fnpdjango to 0.2. --- apps/catalogue/management/commands/assign_from_redmine.py | 4 ++-- apps/catalogue/management/commands/merge_books.py | 1 - apps/catalogue/migrations/0003_from_hg.py | 6 +++--- apps/catalogue/models/book.py | 8 ++++---- apps/catalogue/views.py | 4 ++-- requirements.txt | 5 +++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/apps/catalogue/management/commands/assign_from_redmine.py b/apps/catalogue/management/commands/assign_from_redmine.py index 03c0637d..31bdc149 100644 --- a/apps/catalogue/management/commands/assign_from_redmine.py +++ b/apps/catalogue/management/commands/assign_from_redmine.py @@ -12,7 +12,7 @@ from django.core.management.base import BaseCommand from django.core.management.color import color_style from django.db import transaction -from fnpdjango.utils.text.slughifi import slughifi +from slugify import slugify from catalogue.models import Chunk @@ -91,7 +91,7 @@ class Command(BaseCommand): if fname.endswith('.xml'): fname = fname[:-4] fname = fname.replace(' ', '_') - fname = slughifi(fname) + fname = slugify(fname) chunks = Chunk.objects.filter(book__slug=fname) if not chunks: diff --git a/apps/catalogue/management/commands/merge_books.py b/apps/catalogue/management/commands/merge_books.py index 62f8381e..5499d3d4 100644 --- a/apps/catalogue/management/commands/merge_books.py +++ b/apps/catalogue/management/commands/merge_books.py @@ -8,7 +8,6 @@ from django.core.management.base import BaseCommand from django.core.management.color import color_style from django.db import transaction -from fnpdjango.utils.text.slughifi import slughifi from catalogue.models import Book diff --git a/apps/catalogue/migrations/0003_from_hg.py b/apps/catalogue/migrations/0003_from_hg.py index c0b4dad8..e542d508 100644 --- a/apps/catalogue/migrations/0003_from_hg.py +++ b/apps/catalogue/migrations/0003_from_hg.py @@ -11,7 +11,7 @@ from south.db import db from south.v2 import DataMigration from django.conf import settings -from fnpdjango.utils.text.slughifi import slughifi +from slugify import slugify META_REGEX = re.compile(r'\s*', re.DOTALL | re.MULTILINE) STAGE_TAGS_RE = re.compile(r'^#stage-finished: (.*)$', re.MULTILINE) @@ -54,7 +54,7 @@ def gallery(slug, text): except ValueError: continue - gallery = result.get('gallery', slughifi(slug)) + gallery = result.get('gallery', slugify(slug)) if gallery.startswith('/'): gallery = os.path.basename(gallery) @@ -68,7 +68,7 @@ def migrate_file_from_hg(orm, fname, entry): if fname.endswith('.xml'): fname = fname[:-4] title = file_to_title(fname) - fname = slughifi(fname) + fname = slugify(fname) # create all the needed objects # what if it already exists? diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index a30931da..e320af76 100755 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@ -8,7 +8,7 @@ from django.db import models, transaction from django.template.loader import render_to_string from django.utils.translation import ugettext_lazy as _ from django.conf import settings -from fnpdjango.utils.text.slughifi import slughifi +from slugify import slugify import apiclient @@ -127,7 +127,7 @@ class Book(models.Model): if not title: title = u'część %d' % (i + 1) - slug = slughifi(title) + slug = slugify(title) if i < book_len: chunk = instance[i] @@ -167,7 +167,7 @@ class Book(models.Model): if titles is not None: assert len(titles) == len_other if slugs is None: - slugs = [slughifi(t) for t in titles] + slugs = [slugify(t) for t in titles] for i, chunk in enumerate(other): # move chunk to new book @@ -220,7 +220,7 @@ class Book(models.Model): for i in range(len(self), len(other)): title = u"pusta część %d" % i - chunk = self.add(slughifi(title), title) + chunk = self.add(slugify(title), title) chunk.commit('') for i in range(len(other)): diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index 5aeab7a7..8a96dc68 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -144,7 +144,7 @@ def upload(request): if request.method == "POST": form = forms.DocumentsUploadForm(request.POST, request.FILES) if form.is_valid(): - from fnpdjango.utils.text.slughifi import slughifi + from slugify import slugify if request.user.is_authenticated(): creator = request.user @@ -161,7 +161,7 @@ def upload(request): if filename[-1] == '/': continue title = os.path.basename(filename)[:-4] - slug = slughifi(title) + slug = slugify(title) if not (slug and filename.endswith('.xml')): skipped_list.append(filename) elif slug in slugs: diff --git a/requirements.txt b/requirements.txt index 1bc4f094..3c82e4d1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ --i http://py.mdrn.pl:8443/simple +-i https://py.mdrn.pl:8443/simple ## Python libraries lxml>=2.2.2 @@ -13,13 +13,14 @@ httplib2 # oauth2 dependency ## Django Django>=1.6,<1.7 -fnpdjango<0.2 +fnpdjango>=0.2,<0.3 django-pipeline>=1.2,<1.3 django_cas>=2.1,<2.2 sorl-thumbnail>=11.09,<12 django-maintenancemode>=0.9 django-pagination django-gravatar2 +python-slugify celery>=3.1.12,<3.2 kombu>=3.0,<3.1 -- 2.20.1