Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. from lib.helpers import (
  2. get_attachments_folder_path,
  3. get_document_space,
  4. write_csv,
  5. )
  6. import os
  7. from pathlib import Path
  8. def create_odts_import(CONFIG):
  9. rows = []
  10. for current_path, folders, files in os.walk(CONFIG["absolute_starting_path"]):
  11. if files:
  12. odts = list(
  13. filter(
  14. lambda f: os.path.splitext(f)[-1].lower() == ".odt",
  15. files,
  16. ),
  17. )
  18. if odts:
  19. document_space = get_document_space(CONFIG, current_path)
  20. attachements_folder_path = get_attachments_folder_path(
  21. CONFIG, current_path
  22. )
  23. lines = list(
  24. map(
  25. lambda odtf: {
  26. "documentSpace": document_space
  27. + "."
  28. + odtf.replace(".odt", "").replace(".", "_"),
  29. "documentName": "WebHome",
  30. "documentTitle": Path(odtf).stem.replace(".odt", ""),
  31. "attachmentsFolderPath": attachements_folder_path
  32. + "/"
  33. + odtf,
  34. "pilot": CONFIG["pilot"],
  35. },
  36. odts,
  37. )
  38. )
  39. rows.extend(lines)
  40. write_csv(
  41. f"{CONFIG['export_directory']}/export-odts-pages.csv", CONFIG["fields"], rows
  42. )