Slugify return unicode data

Issue #8 resolved
Johan Charpentier created an issue

Hi,

On tip , when I run tests on this project, I got fails because of unicode :

{{{

FAIL: Doctest: autoslug.tests.ModelWithCallable

Traceback (most recent call last):
File "/usr/lib/pymodules/python2.5/django/test/_doctest.py", line 2180, in runTest raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for autoslug.tests.ModelWithCallable
File "/home/cyberj/tmp/django-autoslug/autoslug/tests.py", line 183, in ModelWithCallable


File "/home/cyberj/tmp/django-autoslug/autoslug/tests.py", line 186, in autoslug.tests.ModelWithCallable Failed example:
a.slug
Expected:
'the-larch'
Got:
u'the-larch' }}} (all fails are in tests_fail.log file)

Because of Django's slugify filter which returns unicode : http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/defaultfilters/tests.py#L110

Here is a file (unicode_slug.diff) which fix all tests

Hope it can help,

Comments (4)

  1. Andy repo owner
    • changed status to open

    Hello Johan, sorry for the delay, didn't have enough tuits. :-) Thanks for your patch.

    However, I've pulled your fork, run ./run_tests.py and got the same problem that you have reported but mirrored: tests complain that unicode values were expected but strings were returned. This in Linux, Python 2.6.4, Django 1.2 beta 1. What's your system environment?

  2. Johan Charpentier reporter

    It fails because of pytils.translit package : this slugify function don't return unicode data but django's slugify yes.

    Tests don't provide AUTOSLUG_SLUGIFY_FUNCTION , and it fallbacks to pytils.translit's slugify function if installed.

    Tests and doc are fixed in my fork with 2 new commits.

  3. Andy repo owner

    Oh I see, you are right. Thanks for investigation and fixes! :) I've pulled your changesets and submitted the updated version to PyPI as 1.3.9.

  4. Former user Account Deleted

    Does django-autoslug work with python 2.7 and django 1.4? I am running these on mac os 10.6.8?

    This is the first app that I am trying to use and when I add autoslug to INSTALLED_APPS I can't even start my server. I just get Error: No module named autoslugblog.

  5. Log in to comment