Ivan Sagalaev wrote:
> Splitting this into new thread since it's already not about db client 
> encodings...
> 
> ak wrote:
>> So if everyone agreed, the way is simple:
>> 1. when django loads data from db and fills in a model object, all 
>> strings have to be encoded according to DEFAULT_CHARSET
>> 2. when django passes data from form object to model object, it has to 
>> encode strings according to DEFAULT_CHARSET again
> 
> No, it would defeat the purpose of all this unicode endeavor. The point 
> is to work internally (view code, models code etc) on unicode objects 
> only. I'd rather propose this:
> 
> - db backend decodes data from db into unicode
> - all models' properties that are now str's should contain unicode all 
> the time (after reading from db and after assigning from forms)
> - user would override __unicode__ of models instead of __str__ that is 
> used now
> - a standard __str__ should be defined as:
> 
>      def __str__(self):
>        return unicode(self).encode(settings.DEFAULT_CHARSET)
> 
> - model validation should call all models' __str__s and warn if they 
> return unicode objects
> 
> I believe migration from __str__ to __unicode__ would as simple as a 
> search/replace operation.
> 
> I apologies if this was already discussed and resolved. If yes, please 
> point me to where it was.

i agree (well, i'm not sure if the migration will really be a 
search/replace, but the rest is ok).

i think currently the "missing" thing is a decision from the "upper 
level" :), about whether django-1.0 will be unicodized( unicodified?) or 
not.


gabor

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to