Use the new duplicate validator for templates

This commit is contained in:
James Westman 2022-06-08 23:10:27 -05:00
parent 22edcf0c67
commit d319cb11c1
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
2 changed files with 4 additions and 10 deletions

View file

@ -37,6 +37,10 @@ class Template(Object):
def not_abstract(self):
pass # does not apply to templates
@validate("name")
def unique_in_parent(self):
self.validate_unique_in_parent(f"Only one template may be defined per file, but this file contains {len(self.parent.children[Template])}",)
def emit_xml(self, xml: XmlEmitter):
xml.start_tag(
"template",