Opened 18 years ago

Closed 17 years ago

#2779 closed enhancement (fixed)

datastructures.MergeDict needs a copy() method

Reported by: limodou Owned by: Adrian Holovaty
Component: Core (Other) Version: dev
Severity: normal Keywords:
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 (last modified by Adrian Holovaty)

django.utils.datastructures.MergeDict does not have a copy() method.

request.REQUEST is an instance of MergeDict, so it's not possible to do request.REQUEST.copy().

Attachments (1)

2779.patch (1.6 KB ) - added by chris.mcavoy@… 17 years ago.
Patch that adds shallow copy method to MergeDict

Download all attachments as: .zip

Change History (7)

comment:1 by Adrian Holovaty, 17 years ago

Description: modified (diff)
Summary: request.REQUEST doesn't support copy() methoddatastructures.MergeDict needs a copy() method

Changed summary and description.

comment:2 by Simon G. <dev@…>, 17 years ago

Triage Stage: UnreviewedAccepted

by chris.mcavoy@…, 17 years ago

Attachment: 2779.patch added

Patch that adds shallow copy method to MergeDict

comment:3 by chris.mcavoy@…, 17 years ago

Has patch: set
Resolution: fixed
Status: newclosed
Version: SVN

Added copy and copy methods to MergeDict. Implements basic shallow copy. I didn't implement deepcopy, as I don't fully understand the role of memo in this documentation: http://www.python.org/doc/1.5.1p1/lib/module-copy.html

Also, it may be useful to change MergeDict to inherit from dict, rather than object. Most of the custom dicts in this module inherit from dict. I didn't know if there was a reason that MergeDict was different. If it's useful to convert MergeDict, I can do that.

I included some doctests in the file. This is my first patch to the project. Hurray for me!

comment:4 by Simon G. <dev@…>, 17 years ago

Resolution: fixed
Status: closedreopened

Thanks Chris :) I've re-opened this so one of the core devs. can see it.

comment:5 by Simon G. <dev@…>, 17 years ago

Triage Stage: AcceptedReady for checkin

comment:6 by Jacob, 17 years ago

Resolution: fixed
Status: reopenedclosed

(In [4640]) Fixed #2779: added a copy() method to MergeDict, along with some new tests for django.utils.datastructures. Thanks, Chris McAvoy.

Note: See TracTickets for help on using tickets.
Back to Top