Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #7
0
 def _get_workbook(self, filename):
     return get_workbook(_make_path('test_upload', '{}.xlsx'.format(filename)))
Пример #8
0
 def _get_workbook(self, filename):
     return get_workbook(_make_path('test_upload', '{}.xlsx'.format(filename)))