diff --git a/composer/schema/factory.py b/composer/schema/factory.py index 183def5..ff97900 100644 --- a/composer/schema/factory.py +++ b/composer/schema/factory.py @@ -39,6 +39,8 @@ class Email(schema.TextLine): # put field type name and other info in standard field classes. schema.Field.__typeInfo__ = ('textline',) +schema.Int.__typeInfo__ = ('number',) +schema.Float.__typeInfo__ = ('number',) schema.Choice.__typeInfo__ = ('dropdown',) diff --git a/composer/schema/grid/field.py b/composer/schema/grid/field.py index aca06b6..7be071f 100644 --- a/composer/schema/grid/field.py +++ b/composer/schema/grid/field.py @@ -78,13 +78,22 @@ class GridFieldInstance(ListFieldInstance): return dict(headers=headers, rows=rows) def unmarshall(self, value): + value = value.strip() if not value: return [] result = [] rows = json.loads(value)['items'] for row in rows: item = {} + empty = True for fi in self.columnFieldInstances: - item[fi.name] = fi.unmarshall(row[fi.name]) - result.append(item) + value = fi.unmarshall(row[fi.name]) + item[fi.name] = value + if fi.default is not None: + if value != fi.default: + empty = False + elif value: + empty = False + if not empty: + result.append(item) return result