def __setattr__(self, attribute, value): """ Set an attribute. See L{SVGElement.__setattr__} for more information, as this function passes on unresolved attributes to it. @type attribute: string @param attribute: The name of the attribute being set. @type value: string or number @param value: The value of the attribute being set. """ if attribute == "color": set_color(self, SVGElement, "stop-color", "stop-opacity", value) else: SVGElement.__setattr__(self, attribute, value)
def __setattr__(self, attribute, value): """ Set an attribute. See L{SVGElement.__setattr__} for more information, as this function passes on unresolved attributes to it. @type attribute: string @param attribute: The name of the attribute being set. @type value: string or number @param value: The value of the attribute being set. """ if attribute == "start": if len(value) != 2: raise ValueError, value SVGElement.__setattr__(self, "x1", value[0]) SVGElement.__setattr__(self, "y1", value[1]) elif attribute == "stop": if len(value) != 2: raise ValueError, value SVGElement.__setattr__(self, "x2", value[0]) SVGElement.__setattr__(self, "y2", value[1]) else: if not StrokedElement.__setattr__(self, attribute, value): SVGElement.__setattr__(self, attribute, value)