Django

Code

Ticket #6110 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

Prevent the Python Format from Being Used with the loaddata and dumpdata Commands

Reported by: empty Assigned to: nobody
Milestone: Component: django-admin.py
Version: SVN Keywords: sprintdec01
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

6110.diff (4.1 kB) - added by empty on 12/02/07 23:47:15.
Added patch and tests
6110-2.diff (4.7 kB) - added by empty on 12/02/07 23:54:09.
Never fails. Forgot the new fixture4.python file for the test.
6110-3.diff (6.7 kB) - added by empty on 12/05/07 12:43:38.
Used flag in place of hardcoding

Change History

12/02/07 21:31:28 changed by Simon G <dev@simon.net.nz>

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • needs_docs changed.

Thanks empty :)

12/02/07 23:47:15 changed by empty

  • attachment 6110.diff added.

Added patch and tests

12/02/07 23:51:12 changed by empty

  • keywords set to sprintdec01.
  • has_patch set to 1.
  • stage changed from Accepted to 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.

12/02/07 23:54:09 changed by empty

  • attachment 6110-2.diff added.

Never fails. Forgot the new fixture4.python file for the test.

12/04/07 14:00:06 changed by jacob

  • needs_better_patch set to 1.
  • stage changed from Ready for checkin to 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.

12/04/07 15:52:41 changed by empty

  • owner changed from nobody to empty.
  • status changed from new to 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.

12/05/07 12:43:38 changed by empty

  • attachment 6110-3.diff added.

Used flag in place of hardcoding

12/05/07 12:49:44 changed by empty

  • owner changed from empty to nobody.
  • needs_better_patch deleted.
  • status changed from assigned to new.
  • stage changed from Accepted to 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.

12/17/07 00:51:51 changed by mtredinnick

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.

12/17/07 00:53:16 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [6922]) Fixed #6110 -- Mark the python format serializer as for internal use only. Thanks, empty.


Add/Change #6110 (Prevent the Python Format from Being Used with the loaddata and dumpdata Commands)




Change Properties
Action