Example #1
0
    def load_tome(self, reader, page_class):
        name = reader.name
        if not util.valid_library_item_name(name):
            raise LoadError(reader.data, "Invalid tome name [name=%s]" % name)

        tome = Tome(name, page_class)
        for page_reader in reader.children:
            tome.add_page(self.load_page(page_reader, page_class))

        return tome
Example #2
0
    def load_tome(self, reader, required_superclass=None):
        name = reader.name
        if not util.valid_library_item_name(name):
            raise LoadError(reader.data, "Invalid tome name [name=%s]" % name)

        typename = reader.get_string(Defs.TOME_TYPE_ATTR, util.tome_typename(Tome))
        tome_class = self.require_tome_class(typename, required_superclass)
        tome = tome_class(name)

        if reader.has_value(Defs.TEMPLATE_ATTR):
            # if this tome has a template, we defer its loading until the end
            self._load_task.pending_templated_tomes.append(TemplatedTome(tome, reader))
        else:
            self._load_tome_now(tome, reader)

        return tome
Example #3
0
    def load_page(self, reader, required_superclass=None):
        name = reader.name
        if not util.valid_library_item_name(name):
            raise LoadError(reader.data, "Invalid tome name [name=%s]" % name)

        typename = reader.require_string(Defs.PAGE_TYPE_ATTR)
        page_class = self.require_page_class(typename, required_superclass)
        page = page_class(name)

        if reader.has_value(Defs.TEMPLATE_ATTR):
            # if this page has a template, we defer its loading until the end
            self._load_task.pending_templated_pages.append(TemplatedPage(page, reader))
        else:
            self._load_page_props(page, reader)

        return page