From 80084d11032c08cb115e20607f4df39e988c642b Mon Sep 17 00:00:00 2001 From: Quinten Steenhuis Date: Thu, 25 Apr 2024 11:38:52 -0400 Subject: [PATCH] Allow using 'data' rather than 'data from code' for al_nav_sections --- docassemble/AssemblyLine/al_document.py | 8 ++++++-- docassemble/AssemblyLine/al_general.py | 8 +++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docassemble/AssemblyLine/al_document.py b/docassemble/AssemblyLine/al_document.py index 3521c3a7..eebd3033 100644 --- a/docassemble/AssemblyLine/al_document.py +++ b/docassemble/AssemblyLine/al_document.py @@ -2244,8 +2244,12 @@ def send_email( return send_email( to=to, template=template, - attachments=set( - self.as_editable_list(key=key) + self.as_pdf_list(key=key) + # Add both DOCX and PDF versions, but if it's not possible to be a DOCX don't add the PDF + # twice + attachments=list( + dict.fromkeys( + self.as_editable_list(key=key) + self.as_pdf_list(key=key) + ) ), **kwargs, ) diff --git a/docassemble/AssemblyLine/al_general.py b/docassemble/AssemblyLine/al_general.py index ea76a8ab..b04c9676 100644 --- a/docassemble/AssemblyLine/al_general.py +++ b/docassemble/AssemblyLine/al_general.py @@ -2078,7 +2078,7 @@ def get_visible_al_nav_items( # For dictionaries at top level item_copy = deepcopy(item) - if not item_copy.pop("hidden", False): # if not hidden + if not str(item_copy.pop("hidden", "False")).lower() == "true": # if not hidden for key, val in item_copy.items(): if isinstance(val, list): # if value of a key is a list new_sublist: List[Union[str, dict]] = [] @@ -2087,8 +2087,10 @@ def get_visible_al_nav_items( if isinstance(subitem, str): new_sublist.append(subitem) # Add dictionaries if not hidden - elif isinstance(subitem, dict) and not subitem.pop( - "hidden", False + elif ( + isinstance(subitem, dict) + and not str(subitem.pop("hidden", "False")).lower() + == "true" ): new_sublist.append(subitem) item_copy[key] = new_sublist