invenio_migrator/records.py
def create_file(self, bucket, key, file_versions):
        """Create a single file with all versions."""
        objs = []
        for file_ver in file_versions:
            f = FileInstance.create().set_uri(
                file_ver['full_path'],
                file_ver['size'],
                'md5:{0}'.format(file_ver['checksum']),
            )
            obj = ObjectVersion.create(bucket, key).set_file(f)
            obj.created = arrow.get(
                file_ver['creation_date']).datetime.replace(tzinfo=None)
            objs.append(obj)

        # Set head version
        db.session.commit()
        return objs[-1]
def create_file(self, bucket, key, file_versions):
        objs = []
        for file_ver in file_versions:
            f = FileInstance.create().set_uri(
                file_ver['full_path'],
                file_ver['size'],
                'md5:{0}'.format(file_ver['checksum']),
            )
            obj = ObjectVersion.create(bucket, key).set_file(f)
            obj.created = arrow.get(
                file_ver['creation_date']).datetime.replace(tzinfo=None)
            objs.append(obj)

        # Set head version
        db.session.commit()
        return objs[-1]
def create_file ( self , bucket , key , file_versions ) : objs = [ ] for file_ver in file_versions : f = FileInstance . create ( ) . set_uri ( file_ver [ 'full_path' ] , file_ver [ 'size' ] , 'md5:{0}' . format ( file_ver [ 'checksum' ] ) , ) obj = ObjectVersion . create ( bucket , key ) . set_file ( f ) obj . created = arrow . get ( file_ver [ 'creation_date' ] ) . datetime . replace ( tzinfo = None ) objs . append ( obj ) # Set head version db . session . commit ( ) return objs [ - 1 ]
Create a single file with all versions.
Create a single file with all versions .