#26826: dumpdata command using multiple pks that are UUIDs produces error
--------------------------------------------+---------------------------
Reporter: KevinGrahamFoster | Owner: nobody
Type: Bug | Status: new
Component: Core (Management commands) | Version: 1.9
Severity: Normal | Keywords: dumpdata uuid
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------------+---------------------------
For any table who's pk is a UUID object this should happen.
Model contains something like:
{{{id = UUIDField(primary_key=True, editable=False, default=uuid.uuid4)}}}
Run from command line:
{{{python manage.py dumpdata foo.field --pks "2d5ae31c-c2ba-
4a81-8351-35376327d33c, bc4e1ee5-1cfe-43f7-84f0-8bce347d144d"}}}
is producing the error
`CommandError: Unable to serialize database: badly formed hexadecimal UUID
string`
In a naive imlementation to address it, I made the following modification
in dumpdata.py, although I've only really been thinking of my use case
here.
{{{
[56]primary_keys = pks.split(',')
for i, primary_key in enumerate(primary_keys):
try:
uuid_item = uuid.UUID(primary_key.strip())
primary_keys[i] = uuid_item
except ValueError:
pass
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26826>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/060.3a898a4f2003d22c3d71ef8b1afbcdc1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.