src/dirbs/importer/importer_utils.py
def prevalidate_file(input_file, schema_file, validator='/opt/validator/bin/validate',
                     schema_dir='/opt/dirbs/etc/schema'):
    """Method which pre-validates the file using an external CSV validator against a CSV schema."""
    try:
        result = subprocess.check_output([validator, '-f', '1', input_file, os.path.join(schema_dir, schema_file)])
        if result.find(b'PASS') == -1:
            raise exceptions.PrevalidationCheckRawException('Pre-validation failed: {0}'.format(result))
        return input_file
    except subprocess.CalledProcessError as err:
        raise exceptions.PrevalidationCheckRawException('Pre-validation failed: {0}'.format(err.stdout))
Method which pre-validates the file using an external CSV validator against a CSV schema.
Method which pre-validates the file using an external CSV validator against a CSV schema.
Method which pre - validates the file using an external CSV validator against a CSV schema .
def prevalidate_file(input_file, schema_file, validator='/opt/validator/bin/validate',
                     schema_dir='/opt/dirbs/etc/schema'):
    try:
        result = subprocess.check_output([validator, '-f', '1', input_file, os.path.join(schema_dir, schema_file)])
        if result.find(b'PASS') == -1:
            raise exceptions.PrevalidationCheckRawException('Pre-validation failed: {0}'.format(result))
        return input_file
    except subprocess.CalledProcessError as err:
        raise exceptions.PrevalidationCheckRawException('Pre-validation failed: {0}'.format(err.stdout))
def prevalidate_file ( input_file , schema_file , validator = '/opt/validator/bin/validate' , schema_dir = '/opt/dirbs/etc/schema' ) : try : result = subprocess . check_output ( [ validator , '-f' , '1' , input_file , os . path . join ( schema_dir , schema_file ) ] ) if result . find ( b'PASS' ) == - 1 : raise exceptions . PrevalidationCheckRawException ( 'Pre-validation failed: {0}' . format ( result ) ) return input_file except subprocess . CalledProcessError as err : raise exceptions . PrevalidationCheckRawException ( 'Pre-validation failed: {0}' . format ( err . stdout ) )
Method which pre-validates the file using an external CSV validator against a CSV schema.
Method which pre - validates the file using an external CSV validator against a CSV schema .
"""Method which pre-validates the file using an external CSV validator against a CSV schema."""
input_file
schema_file
validator
schema_dir