﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
10905	UnicodeEncodeError from FileUploadTests.test_unicode_file_name	Richard Davies <richard.davies@…>	nobody	"Running the test suite on a clean check out of r10628, I get:

{{{
======================================================================
ERROR: test_unicode_file_name (regressiontests.file_uploads.tests.FileUploadTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""/home/elastic-www/test/trunk/tests/regressiontests/file_uploads/tests.py"", line 67, in test_unicode_file_name
    response = self.client.post('/file_uploads/unicode_name/', post_data)
  File ""/home/elastic-www/test/trunk/django/test/client.py"", line 313, in post
    response = self.request(**r)
  File ""/home/elastic-www/test/trunk/django/core/handlers/base.py"", line 92, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File ""/home/elastic-www/test/trunk/tests/regressiontests/file_uploads/views.py"", line 64, in file_upload_unicode_name
    obj = FileModel.objects.create(testfile=uni_named_file)
  File ""/home/elastic-www/test/trunk/django/db/models/manager.py"", line 126, in create
    return self.get_query_set().create(**kwargs)
  File ""/home/elastic-www/test/trunk/django/db/models/query.py"", line 284, in create
    obj.save(force_insert=True)
  File ""/home/elastic-www/test/trunk/django/db/models/base.py"", line 407, in save
    self.save_base(force_insert=force_insert, force_update=force_update)
  File ""/home/elastic-www/test/trunk/django/db/models/base.py"", line 471, in save_base
    values = [(f, f.get_db_prep_save(raw and getattr(self, f.attname) or f.pre_save(self, True))) for f in meta.local_fields if not isinstance(f, AutoField)]
  File ""/home/elastic-www/test/trunk/django/db/models/fields/files.py"", line 191, in pre_save
    file.save(file.name, file, save=False)
  File ""/home/elastic-www/test/trunk/django/db/models/fields/files.py"", line 83, in save
    self._name = self.storage.save(name, content)
  File ""/home/elastic-www/test/trunk/django/core/files/storage.py"", line 46, in save
    name = self.get_available_name(name)
  File ""/home/elastic-www/test/trunk/django/core/files/storage.py"", line 68, in get_available_name
    while self.exists(name):
  File ""/home/elastic-www/test/trunk/django/core/files/storage.py"", line 198, in exists
    return os.path.exists(self.path(name))
  File ""/lib/python2.5/posixpath.py"", line 171, in exists
    st = os.stat(path)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 43-44: ordinal not in range(128)
}}}

My command line to run the tests was:

{{{
$ cat settings.py
DATABASE_ENGINE='sqlite3'
$ ./runtests.py --settings=settings file_uploads
}}}"		closed	File uploads/storage			worksforme		richard.davies@…	Unreviewed	0	0	0	0	0	0
