From 347a069fcd2274f5ae2c31dfde35b65fa492257a Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 8 Oct 2024 10:53:50 +0200 Subject: ✨ document templates: manage export in PDF, HTML, xlsx, docx using LO unoconv MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ishtar_common/utils.py') diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index bca7ce181..d4453ff5a 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -1446,6 +1446,14 @@ def clean_session_cache(session): cache.set(cache_key_list, [], settings.CACHE_TIMEOUT) +def sanitize_filepath(filepath): + #TODO: python3-pathvalidate + # from pathvalidate import sanitize_filepath + # filepath -> sanitize_filepath(filepath) + keep_characters = (" ", ".", "_", "-", "/") + return "".join(c for c in filepath if c.isalnum() or c in keep_characters).rstrip() + + def get_field_labels_from_path(model, path): """ :param model: base model -- cgit v1.2.3