Skip to content

Commit b3e34e9

Browse files
Actually remove DAEmptys from interview dict
Should have already happened in jhpyle/docassemble#877, but that patch isn't working for some reason. Interviews will still error when trying to view the variables and values, but it shouldn't error when trying to send the info with `requests` now.
1 parent 5ec1e39 commit b3e34e9

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

docassemble/EFSPIntegration/efm_client.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
Person,
1515
Individual,
1616
DAStore,
17+
DAEmpty,
1718
DADateTime,
1819
as_datetime,
1920
reconsider,
@@ -92,6 +93,14 @@ def _give_data_url(bundle: ALDocumentBundle, key: str = "final") -> None:
9293
)
9394
doc.page_count = doc_pdf.num_pages()
9495

96+
def _remove_all_da_emptys(json_val):
97+
if isinstance(json_val, DAEmpty):
98+
return None
99+
if isinstance(json_val, list):
100+
return [_remove_all_da_emptys(v) for v in json_val]
101+
if isinstance(json_val, dict):
102+
return {k: _remove_all_da_emptys(v) for k, v in json_val.items()}
103+
return json_val
95104

96105
def _get_all_vars(bundle: ALDocumentBundle, key: str = "final") -> Dict:
97106
"""Strips out some extra big variables that we don't need to serialize and send across the network"""
@@ -132,6 +141,8 @@ def _get_all_vars(bundle: ALDocumentBundle, key: str = "final") -> Dict:
132141
for var in vars_to_pop:
133142
all_vars_dict.pop(var, None)
134143

144+
all_vars_dict = _remove_all_da_emptys(all_vars_dict)
145+
135146
for doc in all_vars_dict.get("al_court_bundle", {}).get("elements", []):
136147
doc.pop("optional_service_options", None)
137148
doc.pop("document_type_options", None)

0 commit comments

Comments
 (0)