Opened 10 years ago

Closed 10 years ago

#2620 closed defect (fixed)

Two-argument form of MergeDict.get() fails

Reported by: shields@… Owned by: Adrian Holovaty
Component: Metasystem Version:
Severity: normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

django.utils.datastructures.MergeDict does not behave completely like a Python intrinsic dict, because the get() method cannot be called without a default argument.

TypeError: get() takes exactly 3 arguments (2 given)

Attached is a patch which fixes this, and adds a unit test for MergeDict.

Attachments (2)

2620.patch (975 bytes) - added by shields@… 10 years ago.
mergedict_get.patch (443 bytes) - added by Chris Beaven 10 years ago.

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by shields@…

Attachment: 2620.patch added

comment:1 Changed 10 years ago by Adrian Holovaty

Summary: [patch] Two-argument form of MergeDict.get() failsTwo-argument form of MergeDict.get() fails

The patch doesn't appear to fix this entirely, and it doesn't include a unit test as you suggest. Are you sure you uploaded the right patch?

comment:2 Changed 10 years ago by Chris Beaven

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

Yea this annoys me too.

comment:3 Changed 10 years ago by Chris Beaven

It doesn't really need a unit test: the fix is dead easy and backwards compatible.

Changed 10 years ago by Chris Beaven

Attachment: mergedict_get.patch added

comment:4 Changed 10 years ago by Chris Beaven

Has patch: set
Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:5 Changed 10 years ago by Jacob

Resolution: fixed
Status: newclosed

(In [4576]) Fixed #2620: made MergeDict.get() correctly work with the two-argument form of get(). Thanks for the patch, SmileyChris.

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