Opened 14 years ago

Closed 14 years ago

#13372 closed (duplicate)

Field instance copying failes before contribute_to_class

Reported by: paluh Owned by: nobody
Component: Uncategorized Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Python copy.copy() called on Field instance which is not contributed to class (before contribute_to_class call) raises:

AttributeError: 'SomeField' object has no attribute 'model'

This issue is related to #12977 changeset. It has added db.models.Field.__setstate__ method which expects that Field instance has 'model' attribute (but it is initialised in contribute_to_class method). I think that copying of instance should be safe all the time and this problem can be easily fixed by 'hasattr' check. Should I provide patch with test?

Change History (1)

comment:1 by Russell Keith-Magee, 14 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #13366

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