Opened 17 years ago
Closed 17 years ago
#6110 closed (fixed)
Prevent the Python Format from Being Used with the loaddata and dumpdata Commands
Reported by: | empty | Owned by: | nobody |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Keywords: | sprintdec01 | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Ticket #4187 identifies a problem with the python serializer when attempting to deserialize data with the loaddata management command after it has been serialized with the dumpdata management command. It was determined that the python serializer should only be used for internal use and not available as a serializer format for these management commands.
We need to detect and prevent the python format from being used with the loaddata and dumpdata management commands and figure out an elegant way to make that clear in the django-admin.py / manage.py documentation.
Attachments (3)
Change History (10)
comment:1 by , 17 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 17 years ago
Has patch: | set |
---|---|
Keywords: | sprintdec01 added |
Triage Stage: | Accepted → Ready for checkin |
Added patch and tests. Test pass fine but I am getting a piece of console output. If you can let me know how to suppress that I'll be happy to fix it.
by , 17 years ago
Attachment: | 6110-2.diff added |
---|
Never fails. Forgot the new fixture4.python file for the test.
comment:3 by , 17 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Ready for checkin → Accepted |
I don't like hardcoding "python" as a "bad" serializer. I think a better approach would be a flag on the serializer module itself marking the module as non-public.
comment:4 by , 17 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
I didn't like that either. :) I figured you would suggest something more appropriate. Thanks for the pointer. I'll get it fixed up soon.
comment:5 by , 17 years ago
Owner: | changed from | to
---|---|
Patch needs improvement: | unset |
Status: | assigned → new |
Triage Stage: | Accepted → Ready for checkin |
Okay a new patch has been added that uses a flag. One other thing I noticed is that we have this construct in several places:
if not _serializers: _load_serializers()
Would it not make more sense to get rid of this and place the check in the _load_serializers function instead? The only place this function call is being made is from the init.py so there would not be any repercussions to the rest of the system.
comment:6 by , 17 years ago
I'm not going to commit the changes to tests/ in this patch because it's not silent. For some reason, output is leaking through, which is misleading, because the tests are passing. This looks like a side effect of calling management.call_command()
and I'm not worried about it, since the patch works, and it's not worth holding up in order to mess around with the test infrastructure for this special case.
comment:7 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Thanks empty :)