def to_tree(self, tagname, obj, namespace=None): tagname = namespaced(self, tagname, namespace) container = Element(tagname) if self.count: container.set('count', str(len(obj))) for v in obj: container.append(v.to_tree()) return container
def to_tree(self, tagname=None, idx=None): parent = Element("fill") el = Element(self.tagname) if self.patternType is not None: el.set('patternType', self.patternType) for c in self.__elements__: value = getattr(self, c) if value != Color(): el.append(value.to_tree(c)) parent.append(el) return parent