28 tests passes now.

This commit is contained in:
Xavier Ordoquy 2012-11-22 08:30:32 +01:00
parent be003145ca
commit 4007b56457

View File

@ -1,3 +1,5 @@
import six
import copy
import datetime
import types
@ -54,7 +56,7 @@ def _get_declared_fields(bases, attrs):
Note that all fields from the base classes are used.
"""
fields = [(field_name, attrs.pop(field_name))
for field_name, obj in attrs.items()
for field_name, obj in list(six.iteritems(attrs))
if isinstance(obj, Field)]
fields.sort(key=lambda x: x[1].creation_counter)
@ -63,7 +65,7 @@ def _get_declared_fields(bases, attrs):
# in order to the correct order of fields.
for base in bases[::-1]:
if hasattr(base, 'base_fields'):
fields = base.base_fields.items() + fields
fields = list(base.base_fields.items()) + fields
return SortedDict(fields)
@ -315,8 +317,8 @@ class BaseSerializer(Field):
return self.object
class Serializer(BaseSerializer):
__metaclass__ = SerializerMetaclass
class Serializer(six.with_metaclass(SerializerMetaclass, BaseSerializer)):
pass
class ModelSerializerOptions(SerializerOptions):