Hi everybody.

I have a UTF-8 encoded fixture (initial_data.yaml, but I think it's 
irrelevant) that contains some data to create auth.Group models. The names 
of models are non-ascii characters. Syncdb and loaddata works smoothly, so 
it's *not* a question "my non-ascii data is not loading".

The problem is, since auth.Group.name is unique field, runs of 
loaddata/syncdb against non-empty database results in 

UnicodeEncodeError: 'ascii' codec can't encode characters in position 
229-242: ordinal not in range(128)

I've debugged a bit and it turns out that:

   1. Fixture is deserialized successfully
   2. Some data in the fixture is loaded into the DB
   3. The load process fails due to duplicate auth.Group.name (that's 
   perfectly valid)

But, instead of displaying meaningful error message like

Could not load auth.Group(pk=None): duplicate key value violates unique 
constraint "auth_group_name_key"
DETAIL:  Key (name)=(Администраторы) already exists.

loaddata fails with abovementioned error. It feels like the error 
processing for loaddata/syncdb is not very friendly to non-ascii data. 

I think it's a bug in django, but FAQ on submitting bugs requires posting 
here first, so I must obey :)

So, the questions are:

   1. Is it really a bug or I'm just trying to do something not really 
   clever
   2. If I'm following the wrong path, what are the best-practices on 
   providing initial authentication data (e.g. default admin accounts, set of 
   groups and permissions, etc.)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to