Django

Code

Ticket #5989 (closed: fixed)

Opened 8 months ago

Last modified 7 months ago

django.db.models.fields.subclassing.Creator.__get__() returns the same value for all instances

Reported by: flupke Assigned to: nobody
Milestone: Component: Database wrapper
Version: SVN Keywords: subclassing SubfieldBase custom field
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

I added a test to modeltests/field_subclassing/ that illustrates the problem (in patch).

I also made a simple fix, storing to_python()-ised data in a per object dict.

Attachments

subclassing.patch (1.3 kB) - added by flupke on 11/26/07 18:53:36.

Change History

11/26/07 18:53:36 changed by flupke

  • attachment subclassing.patch added.

11/26/07 19:32:48 changed by flupke

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

Made a better version of the patch storing the to_python() value in the instance's dict, this way it gets destroyed with the instance without the need of a del method in Creator (thanks to Marty Alchin for explaining me that, see http://gulopine.gamemusic.org/2007/11/python-descriptors-part-2-of-2.html for details).

11/29/07 06:54:17 changed by flupke

  • stage changed from Unreviewed to Ready for checkin.

11/29/07 13:30:49 changed by mtredinnick

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

(In [6748]) Fixed #5989 -- Fixed a problem with values being incorrectly reused by reference in field subclassing. Thanks, flupke.


Add/Change #5989 (django.db.models.fields.subclassing.Creator.__get__() returns the same value for all instances)




Change Properties
Action