- def build(self, builder, **kwargs):
- return builder().build(self, **kwargs)
+ @property
+ def children(self):
+ for part_uri in self.meta.parts or []:
+ yield type(self)(
+ filename=self.provider.by_slug(part_uri.slug),
+ provider=self.provider
+ )
+
+ def build(self, builder, base_url=None, **kwargs):
+ return builder(base_url=base_url).build(self, **kwargs)
+
+ def assign_ids(self, existing=None):
+ # Find all existing IDs.
+ existing = existing or set()
+ que = [self.tree.getroot()]
+ while que:
+ item = que.pop(0)
+ try:
+ item.normalize_insides()
+ except AttributeError:
+ pass
+ existing.add(item.attrib.get('id'))
+ que.extend(item)