Django

Code

Ticket #2779 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

datastructures.MergeDict needs a copy() method

Reported by: limodou Assigned to: adrian
Milestone: Component: Core framework
Version: SVN Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description (Last modified by adrian)

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

2779.patch (1.6 kB) - added by chris.mcavoy@gmail.com on 02/26/07 15:19:27.
Patch that adds shallow copy method to MergeDict?

Change History

09/26/06 10:46:16 changed by adrian

  • description changed.
  • summary changed from request.REQUEST doesn't support copy() method to datastructures.MergeDict needs a copy() method.

Changed summary and description.

01/30/07 03:21:50 changed by Simon G. <dev@simon.net.nz>

  • stage changed from Unreviewed to Accepted.

02/26/07 15:19:27 changed by chris.mcavoy@gmail.com

  • attachment 2779.patch added.

Patch that adds shallow copy method to MergeDict?

02/26/07 15:25:05 changed by chris.mcavoy@gmail.com

  • status changed from new to closed.
  • has_patch set to 1.
  • version set to SVN.
  • resolution set to fixed.

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!

02/26/07 15:45:39 changed by Simon G. <dev@simon.net.nz>

  • status changed from closed to reopened.
  • resolution deleted.

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

02/26/07 15:45:46 changed by Simon G. <dev@simon.net.nz>

  • stage changed from Accepted to Ready for checkin.

02/27/07 18:35:51 changed by jacob

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

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


Add/Change #2779 (datastructures.MergeDict needs a copy() method)




Change Properties
Action