#10728 closed (fixed)
[PATCH] SubfieldBase classes can't be subclassed.
Reported by: | Gabriel | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Keywords: | ||
Cc: | simon@…, eric@…, martin@…, Christian Schilling, Joel Watts, Sayane, George Sakkis | 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
The contribute_to_class method that SubfieldBase creates goes into an endless recursion if the SubfieldBase-using class is subclassed.
This is fixed by passing the actual field class to make the correct super call.
The patches have been applied on both trunk and releases/1.0.X . All tests pass, including one modified to test for this defect.
Attachments (5)
Change History (25)
by , 16 years ago
Attachment: | 0001-Create-a-test-highlighting-a-SubfieldBase-issue.patch added |
---|
by , 16 years ago
Attachment: | 0002-Allow-subclassing-field-types-that-use-the-SubfieldB.patch added |
---|
fix
comment:1 by , 16 years ago
Cc: | added |
---|
comment:2 by , 16 years ago
Needs tests: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Please also include a test case as part of the patch. Something that fails beforehand and works afterwards, so that we can ensure there's no regression in the future.
comment:3 by , 16 years ago
Needs tests: | unset |
---|
Thanks! A test is already included, I extended the fields_subclassing test.
The first attached patch does the regression testing, and the second one fixes the issue. If you apply just the first patch, the 'fields_subclassing' test fails.
by , 15 years ago
Attachment: | 0001-Allow-subclassing-field-types-that-use-the-SubfieldB.patch added |
---|
Both patches squashed, and a nicer test failure mode. Tested on 1.2.0a1 trunk.
comment:5 by , 15 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Someone forgot to apply. Can it be done now?
Here is both patches squashed in one, and a nicer test failure than a recursion error.
The patch applies cleanly and passes tests on trunk, 1.0.X and 1.1.X.
by , 15 years ago
Attachment: | SubfieldBase-#10728-r12890.patch added |
---|
comment:6 by , 15 years ago
Attached alternative, more compact version + updated test, patched against SVN (r12890).
comment:7 by , 15 years ago
milestone: | → 1.2 |
---|
comment:8 by , 15 years ago
Cc: | added |
---|---|
Needs documentation: | set |
comment:9 by , 15 years ago
Needs documentation: | unset |
---|
comment:11 by , 15 years ago
I don't understand, what's the problem in applying an accepted, ready-for-checkin patch sitting here for a whole year ?
comment:12 by , 14 years ago
Cc: | added |
---|
comment:13 by , 14 years ago
Patch needs improvement: | set |
---|---|
Summary: | [PATCH] SubfieldBase classes can't be subclassed. → SubfieldBase classes can't be subclassed. |
Triage Stage: | Ready for checkin → Accepted |
This was marked as RFC by patch submitter, so it didn't get reviewed. The previous patch doesn't apply cleanly. The most recent patch breaks the test suite.
comment:14 by , 14 years ago
Patch needs improvement: | unset |
---|---|
Summary: | SubfieldBase classes can't be subclassed. → [PATCH] SubfieldBase classes can't be subclassed. |
The most recent patch breaks the test suite.
Just tested http://code.djangoproject.com/attachment/ticket/10728/SubfieldBase-%2310728-r12890.patch with the latest commit (r136309), it works for me.
comment:15 by , 14 years ago
Cc: | added |
---|
comment:16 by , 14 years ago
milestone: | → 1.3 |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Revamped and migrated the doctests into proper unit tests.
comment:17 by , 14 years ago
Cc: | added |
---|
by , 14 years ago
Attachment: | 10728.patch added |
---|
Added the new in Django 1.2 connection argument in get_db_prep_save()
comment:18 by , 14 years ago
Cc: | added; removed |
---|
comment:19 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
test