Mercurial > parpg-source
comparison components/container.py @ 95:d67e8288e9bf
Added saveable_fields to Container.
author | KarstenBock@gmx.net |
---|---|
date | Tue, 27 Sep 2011 15:57:36 +0200 |
parents | 939984cff702 |
children | f94d4577ca5e |
comparison
equal
deleted
inserted
replaced
94:5ab004fa4a2e | 95:d67e8288e9bf |
---|---|
9 # GNU General Public License for more details. | 9 # GNU General Public License for more details. |
10 # | 10 # |
11 # You should have received a copy of the GNU General Public License | 11 # You should have received a copy of the GNU General Public License |
12 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 12 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
13 | 13 |
14 from copy import deepcopy | |
15 | |
14 from base import Base | 16 from base import Base |
15 | 17 |
16 class Container(Base): | 18 class Container(Base): |
17 """ | 19 """ |
18 Component that allows an entity to contain one or more child entities. | 20 Component that allows an entity to contain one or more child entities. |
19 """ | 21 """ |
20 | 22 |
21 def __init__(self): | 23 def __init__(self): |
22 Base.__init__(self, children=list, max_bulk=int) | 24 Base.__init__(self, children=list, max_bulk=int) |
25 | |
26 @property | |
27 def saveable_fields(self): | |
28 fields = deepcopy(self.fields) | |
29 del fields["children"] | |
30 return fields | |
31 | |
23 | 32 |
24 | 33 |
25 class BulkLimitError(Exception): | 34 class BulkLimitError(Exception): |
26 """Error that gets raised when the item would exceed the | 35 """Error that gets raised when the item would exceed the |
27 bulk limit of the container.""" | 36 bulk limit of the container.""" |