Hello.

I think there is a problem in django.contrib.admin.models code:
string slice ("object_repr[:200]") doesn't respect multibyte encodings
(UTF8).

<code>
class LogEntryManager(models.Manager):
    def log_action(self, user_id, content_type_id, object_id,
object_repr, action_flag, change_message=''):
        e = self.model(None, None, user_id, content_type_id, object_id,
object_repr[:200], action_flag, change_message)
        e.save()
</code>

Fortunately it's easy to fix the bug(?) - see code below.
Note: the patch is not universal(?): it assumes UTF8 as your encoding.


### patch begin ###

12c12
<         e = self.model(None, None, user_id, content_type_id,
object_id, object_repr[:200], action_flag, change_message)
---
>         e = self.model(None, None, user_id, content_type_id, object_id, 
> object_repr.decode('utf-8')[:200].encode('utf-8'), action_flag, 
> change_message)

### end patch ###


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

Reply via email to