From 13f86550c671fc0edeadd6ba3f542ed2d4ed7af8 Mon Sep 17 00:00:00 2001 From: Jace Browning Date: Mon, 27 Apr 2015 22:26:52 -0400 Subject: [PATCH] Create new containers via default() --- yorm/__init__.py | 2 +- yorm/converters/containers.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/yorm/__init__.py b/yorm/__init__.py index 812b70d..4e0c8f3 100644 --- a/yorm/__init__.py +++ b/yorm/__init__.py @@ -3,7 +3,7 @@ import sys __project__ = 'YORM' -__version__ = '0.4dev14' +__version__ = '0.4.dev15' VERSION = __project__ + '-' + __version__ diff --git a/yorm/converters/containers.py b/yorm/converters/containers.py index d79641e..170d513 100644 --- a/yorm/converters/containers.py +++ b/yorm/converters/containers.py @@ -106,7 +106,7 @@ def apply(self, data): if issubclass(converter, Container): container = getattr(self, name, None) if not isinstance(container, converter): - container = converter() + container = converter.default() setattr(self, name, container) container.apply(data) value[name] = container @@ -152,7 +152,7 @@ def to_value(cls, data): for item in to_list(data): if issubclass(cls.item_type, Container): - container = cls.item_type() # pylint: disable=E1120 + container = cls.item_type.default() # pylint: disable=E1120 container.apply(item) value.append(container) else: @@ -187,10 +187,10 @@ def apply(self, data): try: container = self[len(value)] except IndexError: - container = converter() # pylint: disable=E1120 + container = converter.default() # pylint: disable=E1120 else: if not isinstance(container, converter): - container = converter() # pylint: disable=E1120 + container = converter.default() # pylint: disable=E1120 container.apply(item) value.append(container)