Improved logic in GroupNamedType

This commit is contained in:
Syrus Akbary 2015-12-06 14:36:47 -08:00
parent 12e4e2c006
commit c9e7f67ff9
2 changed files with 6 additions and 5 deletions

View File

@ -143,8 +143,11 @@ class GroupNamedType(BaseType):
name = type.name or type.attname
return name, schema.T(type)
def iter_types(self, schema):
return map(partial(self.get_named_type, schema), self.types)
def internal_type(self, schema):
return OrderedDict(map(partial(self.get_named_type, schema), self.types))
return OrderedDict(self.iter_types(schema))
def __len__(self):
return len(self.types)

View File

@ -145,11 +145,9 @@ class InputField(NamedType, OrderedType):
class FieldsGroupType(GroupNamedType):
def internal_type(self, schema):
fields = []
def iter_types(self, schema):
for field in sorted(self.types):
try:
fields.append(self.get_named_type(schema, field))
yield self.get_named_type(schema, field)
except SkipField:
continue
return OrderedDict(fields)