Example #1
0
    def restoreValueFile(self, **kwargs):
        """Restore the backup value if exists"""

        backup_path = self.getBackupFilePath(**kwargs)
        if not os.path.exists(backup_path):
            return
        value_path = self.getValueFilePath(**kwargs)
        move_file(backup_path, value_path)
Example #2
0
    def restoreValueFile(self, **kwargs):
        """Restore the backup value if exists"""

        backup_path = self.getBackupFilePath(**kwargs)
        if not os.path.exists(backup_path):
            return
        value_path = self.getValueFilePath(**kwargs)
        move_file(backup_path, value_path)
Example #3
0
    def moveValueFile(self, **kwargs):
        """File properties has changed, move it its new locations"""

        # Delete uid to avoid multiple key errors
        new_kwargs = kwargs.copy()
        del new_kwargs['uid']

        src_path = self.getValueFilePath(uid=kwargs['src_uid'], **new_kwargs)
        if not os.path.exists(src_path):
            return
        dst_path = self.getValueFilePath(**kwargs)
        move_file(src_path, dst_path)
Example #4
0
    def unsetValueFile(self, **kwargs):
        """Remove file value if exists"""

        # This is a cut/paste operation. There is no need to delete file
        if kwargs.get('is_moved', False):
            return

        value_path = self.getValueFilePath(**kwargs)
        if not os.path.exists(value_path):
            return
        backup_path = self.getBackupFilePath(**kwargs)
        move_file(value_path, backup_path)
Example #5
0
    def moveValueFile(self, **kwargs):
        """File properties has changed, move it its new locations"""

        # Delete uid to avoid multiple key errors
        new_kwargs = kwargs.copy()
        del new_kwargs['uid']

        src_path = self.getValueFilePath(uid=kwargs['src_uid'], **new_kwargs)
        if not os.path.exists(src_path):
            return
        dst_path = self.getValueFilePath(**kwargs)
        move_file(src_path, dst_path)
Example #6
0
    def unsetValueFile(self, **kwargs):
        """Remove file value if exists"""

        # This is a cut/paste operation. There is no need to delete file
        if kwargs.get('is_moved', False):
            return

        value_path = self.getValueFilePath(**kwargs)
        if not os.path.exists(value_path):
            return
        backup_path = self.getBackupFilePath(**kwargs)
        move_file(value_path, backup_path)