Skip to content
This repository has been archived by the owner on Oct 3, 2019. It is now read-only.

Commit

Permalink
Create new containers via default()
Browse files Browse the repository at this point in the history
  • Loading branch information
jacebrowning committed Apr 28, 2015
1 parent 256e20d commit 13f8655
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion yorm/__init__.py
Expand Up @@ -3,7 +3,7 @@
import sys

__project__ = 'YORM'
__version__ = '0.4dev14'
__version__ = '0.4.dev15'

VERSION = __project__ + '-' + __version__

Expand Down
8 changes: 4 additions & 4 deletions yorm/converters/containers.py
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 13f8655

Please sign in to comment.