Opened 18 years ago

Closed 18 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: no UI/UX: no

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@… 18 years ago.
mergedict_get.patch (443 bytes ) - added by Chris Beaven 18 years ago.

Download all attachments as: .zip

Change History (7)

by shields@…, 18 years ago

Attachment: 2620.patch added

comment:1 by Adrian Holovaty, 18 years ago

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 by Chris Beaven, 18 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

Yea this annoys me too.

comment:3 by Chris Beaven, 18 years ago

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

by Chris Beaven, 18 years ago

Attachment: mergedict_get.patch added

comment:4 by Chris Beaven, 18 years ago

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

comment:5 by Jacob, 18 years ago

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