Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong import of i18n content #82

Open
miceno opened this issue Jul 31, 2014 · 0 comments
Open

Wrong import of i18n content #82

miceno opened this issue Jul 31, 2014 · 0 comments

Comments

@miceno
Copy link
Contributor

miceno commented Jul 31, 2014

I have a dataset on utf-8, containing Spanish tilde chars. Here it is:

ESPAÑA
    MADRID
FRANCIA
    PARÍS

When trying to import with import_categories, it fails.

(pytesting)orestes-retina:core_categories$ python manage.py import_categories --settings=settings.development core_categories/fixtures/bug-categories-utf8.txt 
Traceback (most recent call last):
  File "manage.py", line 16, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/orestes/Downloads/pytesting/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/Users/orestes/Downloads/pytesting/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/orestes/Downloads/pytesting/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/orestes/Downloads/pytesting/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/Users/orestes/Downloads/devel/bullipedia-core/core_categories/categories/management/commands/import_categories.py", line 90, in handle
    self.parse_lines(data)
  File "/Users/orestes/Downloads/devel/bullipedia-core/core_categories/categories/management/commands/import_categories.py", line 73, in parse_lines
    current_parents = {0: self.make_category(line)}
  File "/Users/orestes/Downloads/pytesting/lib/python2.7/site-packages/django/db/transaction.py", line 431, in inner
    return func(*args, **kwargs)
  File "/Users/orestes/Downloads/devel/bullipedia-core/core_categories/categories/management/commands/import_categories.py", line 37, in make_category
    slug=slugify(SLUG_TRANSLITERATOR(string.strip()))[:49],
  File "/Users/orestes/Downloads/pytesting/lib/python2.7/site-packages/slugify.py", line 26, in slugify
    unicodedata.normalize('NFKD', string)
TypeError: must be unicode, not str

Googling about the error I found a reference to slugify expecting a unicode string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant