Ejemplo n.º 1
0
 def _get_workbook_from_data(self, headers, rows):
     file = BytesIO()
     export_raw(headers, rows, file, format=Format.XLS_2007)
     with tempfile.TemporaryFile(suffix='.xlsx') as f:
         f.write(file.getvalue())
         f.seek(0)
         return get_workbook(f)
Ejemplo n.º 2
0
 def _get_workbook_from_data(self, headers, rows):
     file = BytesIO()
     export_raw(headers, rows, file, format=Format.XLS_2007)
     with tempfile.TemporaryFile(suffix='.xlsx') as f:
         f.write(file.getvalue())
         f.seek(0)
         return get_workbook(f)
Ejemplo n.º 3
0
def upload_fixture_file(domain, filename, replace, task=None):
    """
    should only ever be called after the same file has been validated
    using validate_fixture_file_format

    """

    workbook = get_workbook(filename)
    return _run_fixture_upload(domain, workbook, replace=replace, task=task)
Ejemplo n.º 4
0
def upload_fixture_file(domain, filename, replace, task=None):
    """
    should only ever be called after the same file has been validated
    using validate_fixture_file_format

    """

    workbook = get_workbook(filename)
    return _run_fixture_upload(domain, workbook, replace=replace, task=task)
Ejemplo n.º 5
0
def validate_fixture_file_format(file_or_filename):
    """
    Does basic validation on the uploaded file. Raises a FixtureUploadError if
    something goes wrong.
    """
    workbook = get_workbook(file_or_filename)
    workbook.get_types_sheet()
    error_messages = _validate_fixture_upload(workbook)
    if error_messages:
        raise FixtureUploadError(error_messages)
Ejemplo n.º 6
0
def validate_fixture_file_format(file_or_filename):
    """
    Does basic validation on the uploaded file. Raises a FixtureUploadError if
    something goes wrong.
    """
    workbook = get_workbook(file_or_filename)
    workbook.get_types_sheet()
    error_messages = _validate_fixture_upload(workbook)
    if error_messages:
        raise FixtureUploadError(error_messages)
Ejemplo n.º 7
0
 def _get_workbook(self, filename):
     return get_workbook(_make_path('test_upload', '{}.xlsx'.format(filename)))
Ejemplo n.º 8
0
 def _get_workbook(self, filename):
     return get_workbook(_make_path('test_upload', '{}.xlsx'.format(filename)))