def odf_get_document(uri): """Return an "odf_document" instance of the ODF document stored in the given file-like object or at the given URI. Example:: >>> document = odf_get_document(stringio) >>> uri = 'uri://of/a/document.odt' >>> document = odf_get_document(uri) """ container = odf_get_container(uri) return odf_document(container)
def odf_get_document(path_or_file): """Return an "odf_document" instance of the ODF document stored at the given local path or in the given (open) file-like object. Examples:: >>> document = odf_get_document('/tmp/document.odt') >>> stringio = StringIO(...) >>> document = odf_get_document(stringio) >>> file = urllib.urlopen('http://example.com/document.odt') >>> document = odf_get_document(file) """ container = odf_get_container(path_or_file) return odf_document(container)