def save(self, objects, **kwargs): """ Save the given objects to the item path on disc. :type objects: list[str] :type kwargs: dict """ super(MirrorItem, self).save(**kwargs) # Save the mirror table to the given location mutils.saveMirrorTable( self.path() + "/mirrortable.json", objects, metadata={"description": kwargs.get("comment", "")}, leftSide=kwargs.get("leftSide"), rightSide=kwargs.get("rightSide"), mirrorPlane=kwargs.get("mirrorPlane"), )
def write(self, path, objects, iconPath="", **options): """ Write the given objects to the given path on disc. :type path: str :type objects: list[str] :type iconPath: str :type options: dict """ super(MirrorItem, self).write(path, objects, iconPath, **options) # Save the mirror table to the given location mutils.saveMirrorTable( path + "/mirrortable.json", objects, metadata={"description": options.get("comment", "")}, leftSide=options.get("leftSide"), rightSide=options.get("rightSide"), )
def save(self, objects, leftSide, rightSide, path="", iconPath="", metadata=None, **kwargs): """ Save the given objects to the location of the current mirror table. :type objects: list[str] :type leftSide: str :type rightSide: str :type path: str :type iconPath: str :type metadata: None or dict """ if path and not path.endswith(".mirror"): path += ".mirror" logger.info("Saving: %s" % self.transferPath()) # Remove and create a new temp directory tempPath = mutils.createTempPath() + "/" + self.transferBasename() # Save the mirror table to the temp location mutils.saveMirrorTable( tempPath, objects, metadata=metadata, leftSide=leftSide, rightSide=rightSide, ) # Move the mirror table to the given path using the base class contents = [tempPath, iconPath] super(MirrorItem, self).save(path, contents=contents, **kwargs)