Permalink
Browse files

Adding field name to assertion error when assigning invalid object to

foreign key field, fixes #49 (pull req had a syntax error)
  • Loading branch information...
coleifer committed Jan 30, 2012
1 parent 0994f90 commit 7f9c2720d278f9112f2db9b4a8b4770daee8733b
Showing with 1 addition and 1 deletion.
  1. +1 −1 peewee.py
View
@@ -2043,7 +2043,7 @@ def __set__(self, instance, obj):
if isinstance(obj, int):
setattr(instance, self.field_column, obj)
else:
- assert isinstance(obj, self.to), "Cannot assign %s, invalid type" % obj
+ assert isinstance(obj, self.to), "Cannot assign %s to %s, invalid type" % (obj, sel.field.name)

This comment has been minimized.

Show comment
Hide comment
@karlb

karlb Jan 30, 2012

There an "f" missing in "sel.field.name"

@karlb

karlb Jan 30, 2012

There an "f" missing in "sel.field.name"

This comment has been minimized.

Show comment
Hide comment
@coleifer

coleifer Jan 30, 2012

Owner

derp thanks mane 46f073d

@coleifer

coleifer Jan 30, 2012

Owner

derp thanks mane 46f073d

setattr(instance, self.field_column, obj.get_pk())
setattr(instance, self.cache_name, obj)

0 comments on commit 7f9c272

Please sign in to comment.