Merge pull request #92 from mwesterhof/master

Serializer.serialize_model fix of uncaught _SkipField exceptions
This commit is contained in:
Marko Tibold 2011-12-13 04:06:40 -08:00
commit 4f38e78580

View File

@ -229,6 +229,7 @@ class Serializer(object):
# serialize each required field # serialize each required field
for fname in fields: for fname in fields:
try:
if hasattr(self, smart_str(fname)): if hasattr(self, smart_str(fname)):
# check first for a method 'fname' on self first # check first for a method 'fname' on self first
meth = getattr(self, fname) meth = getattr(self, fname)
@ -243,7 +244,6 @@ class Serializer(object):
else: else:
continue continue
try:
key = self.serialize_key(fname) key = self.serialize_key(fname)
val = self.serialize_val(fname, obj) val = self.serialize_val(fname, obj)
data[key] = val data[key] = val