diff options
Diffstat (limited to 'tablib/formats/_ods.py')
| -rw-r--r-- | tablib/formats/_ods.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tablib/formats/_ods.py b/tablib/formats/_ods.py index 5b900b5..dbf57c4 100644 --- a/tablib/formats/_ods.py +++ b/tablib/formats/_ods.py @@ -91,3 +91,14 @@ def dset_sheet(dataset, ws): cell = table.TableCell() cell.addElement(text.P(text=col)) odf_row.addElement(cell) + + +def detect(stream): + if isinstance(stream, bytes): + # load expects a file-like object. + stream = BytesIO(stream) + try: + opendocument.load(stream) + return True + except Exception: + return False |
