def set_templates(self): self.templates = self.traittemplate.templates(self.name) while self.templ_element.hasChildNodes(): del self.templ_element.childNodes[0] for template in self.templates: element = TemplateElement(template.package, template.template) for att in ['package', 'mode', 'owner', 'grp_owner']: element.setAttribute(att, template[att]) self.templ_element.appendChild(element)