Py3 fixes

This commit is contained in:
Fabrice Salvaire 2016-10-19 21:20:31 +02:00
parent ef1f3b29ec
commit a256bca398
2 changed files with 4 additions and 4 deletions

View file

@ -56,7 +56,7 @@ class TestCase(unittest.TestCase):
})
def create_project(self, name):
models.db.session.add(models.Project(id=name, name=unicode(name),
models.db.session.add(models.Project(id=name, name=name,
password=name, contact_email="%s@notmyidea.org" % name))
models.db.session.commit()

View file

@ -12,10 +12,10 @@ def slugify(value):
Copy/Pasted from ametaireau/pelican/utils itself took from django sources.
"""
if type(value) == unicode:
if type(value) == str:
import unicodedata
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore')
value = unicode(re.sub('[^\w\s-]', '', value).strip().lower())
value = unicodedata.normalize('NFKD', value)
value = re.sub('[^\w\s-]', '', value).strip().lower()
return re.sub('[-\s]+', '-', value)