# HG changeset patch # User KarstenBock@gmx.net # Date 1314960883 -7200 # Node ID eab8af30dfc7974792b80912c492bce2933fd7de # Parent 979fffc5af496127a99afe67e03b0c0f51786082 get_free_slot no raises an exception instead of appending a slot to the container. diff -r 979fffc5af49 -r eab8af30dfc7 components/container.py --- a/components/container.py Fri Sep 02 12:29:55 2011 +0200 +++ b/components/container.py Fri Sep 02 12:54:43 2011 +0200 @@ -32,7 +32,13 @@ def __str__(self): return "Item would exceed the bulk limit of the container." - + +class NoFreeSlotError(Exception): + """Error that gets raised when the container has no free slots.""" + + def __str__(self): + return "Container can't hold any more items." + def get_free_slot(container): """Returns the first slot of the container that is not occupied.""" index = 0 @@ -40,8 +46,7 @@ if not child: return index index += 1 - container.children.append(None) - return index + raise NoFreeSlotError def get_total_bulk(container): """Returns the bulk of all items in the container."""