1
0
Fork 0
mirror of https://github.com/Oreolek/gamebookformat.git synced 2024-05-14 23:18:19 +03:00

Now an error to have sections with the same name.

This commit is contained in:
Pelle Nilsson 2013-06-04 22:32:51 +02:00
parent 5e187d3252
commit 4dc609c1a2

View file

@ -30,6 +30,9 @@ class Book:
self.max = 0
def add(self, section):
if section.name in self.from_name:
raise Exception('Duplicate section names (%s) not allowed.' %
section.name)
self.sections.append(section)
self.from_name[section.name] = section
if len(self.sections) > self.max: