Opened 14 years ago

Closed 13 years ago

#2779 closed enhancement (fixed)

datastructures.MergeDict needs a copy() method

Reported by: limodou Owned by: Adrian Holovaty
Component: Core (Other) Version: master
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@… 13 years ago.
Patch that adds shallow copy method to MergeDict

Download all attachments as: .zip

Change History (7)

comment:1 Changed 14 years ago by Adrian Holovaty

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

Changed summary and description.

comment:2 Changed 14 years ago by Simon G. <dev@…>

Triage Stage: UnreviewedAccepted

Changed 13 years ago by chris.mcavoy@…

Attachment: 2779.patch added

Patch that adds shallow copy method to MergeDict

comment:3 Changed 13 years ago by chris.mcavoy@…

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:

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 Changed 13 years ago by Simon G. <dev@…>

Resolution: fixed
Status: closedreopened

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

comment:5 Changed 13 years ago by Simon G. <dev@…>

Triage Stage: AcceptedReady for checkin

comment:6 Changed 13 years ago by Jacob

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