Beispiel #1
0
def copy_element(element: Element) -> ElementCopy:
    buffer = {}

    def save_func(name, value):
        # do not copy Element.presentation, to avoid cyclic dependencies
        if name != "presentation":
            buffer[name] = serialize(value)

    element.save(save_func)
    return ElementCopy(cls=element.__class__, id=element.id, data=buffer)
Beispiel #2
0
 def unlink(self):
     self.is_unlinked = True
     Element.unlink(self)