http://www.djangosnippets.org/snippets/335/

On 25 сент, 00:52, Leo Shklovskii <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to represent an Active Directory's user guid in Django. In
> AD, its a 128 bit integer that I can pull out with using the ldap
> library. When I access the guid, python treats it as a string with most
> of the characters escaped, so something like:
>
> "\xdd3\x9e0\xd9\xf4\x93B\x90\xdehDe\xd6\xbaq"
>
> I'm storing this in my model as a CharField:
>
> class Person(models.Model):
>         ...
>         uuid = models.CharField(maxlength=16, db_index=True, unique=True)
>
> So far so good, but when I try to create an initial data fixture that
> contains the uuid and run manage.py syncdb, I get an error:
>
> {
>      "pk" : 1,
>      "model" : "faces.Person",
>      "fields" : {
>          ...
>          "uuid" : "\xdd3\x9e0\xd9\xf4\x93B\x90\xdehDe\xd6\xbaq",
>          ...
>      }
>
> }
>
>  > manage.py syncdb
> ...
> Problem installing fixture: Invalid \escape: 'x' line 14 column 15
> ...
>
> Is this a known issue? Is it a bug in the parsing? Is there a better way
> to represent the guid in my model? (I know Python 2.5 had a uuid object,
> but I'm still on 2.4).
>
> --
> --Leo


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to