Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docassemble/AssemblyLine/al_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
DAFile,
DAFileCollection,
DAFileList,
DALazyTemplate,
defined,
pdf_concatenate,
zip_file,
Expand Down Expand Up @@ -315,6 +316,9 @@ def overflow_value(

# If trigger is not a boolean value, overflow value is the value that starts at the end of the safe value.
original_value = self.value_if_defined()
# Ensure a DALazyTemplate is rendered to a string for downstream string ops
if isinstance(original_value, DALazyTemplate):
original_value = str(original_value)
safe_text = self.safe_value(
overflow_message=overflow_message,
input_width=input_width,
Expand Down Expand Up @@ -409,6 +413,9 @@ def has_overflow(
val = _original_value
else:
val = self.value_if_defined()
# If this is a template block, render it now so comparisons work correctly
if isinstance(val, DALazyTemplate):
val = str(val)

return (
self.safe_value(
Expand Down Expand Up @@ -508,6 +515,11 @@ def safe_value(
value = _original_value
else:
value = self.value_if_defined()

# Convert template blocks to strings for purposes of evaluating overflow
if isinstance(value, DALazyTemplate):
value = str(value)

if (
isinstance(value, str)
and len(value) <= self.overflow_trigger
Expand Down
Loading