Skip to content

Commit

Permalink
Merge pull request #817 from SuffolkLITLab/patch-assuming-addresses-a…
Browse files Browse the repository at this point in the history
…re-aladdress

Don't pass 'bare' parameter unless it's an ALAddress
  • Loading branch information
nonprofittechy authored Jan 19, 2024
2 parents f3ec875 + 0c3f3c9 commit 151476f
Showing 1 changed file with 41 additions and 18 deletions.
59 changes: 41 additions & 18 deletions docassemble/AssemblyLine/al_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,13 @@ def names_and_addresses_on_one_line(
"""
return comma_and_list(
[
str(person) + ", " + person.address.on_one_line(bare=bare)
str(person)
+ ", "
+ (
person.address.on_one_line(bare=bare)
if isinstance(person.address, ALAddress)
else str(person.address.on_one_line())
)
for person in self
],
comma_string=comma_string,
Expand Down Expand Up @@ -1437,29 +1443,46 @@ def address_block(
str: The formatted address block.
"""
if this_thread.evaluation_context == "docx":
return (
self.name.full()
+ '</w:t><w:br/><w:t xml:space="preserve">'
+ self.address.block(
if isinstance(self.address, ALAddress):
return self.address.block(
language=language,
international=international,
show_country=show_country,
bare=bare,
show_impounded=show_impounded,
)
)
return (
"[FLUSHLEFT] "
+ self.name.full()
+ " [NEWLINE] "
+ self.address.block(
language=language,
international=international,
show_country=show_country,
bare=bare,
show_impounded=show_impounded,
)
)
else:
# bare parameter is ignored for plain Address objects
return self.address.block(
language=language,
international=international,
show_country=show_country,
)
else:
if isinstance(self.address, ALAddress):
return (
"[FLUSHLEFT] "
+ self.name.full()
+ " [NEWLINE] "
+ self.address.block(
language=language,
international=international,
show_country=show_country,
bare=bare,
show_impounded=show_impounded,
)
)
else:
return (
"[FLUSHLEFT] "
+ self.name.full()
+ " [NEWLINE] "
+ self.address.block(
language=language,
international=international,
show_country=show_country,
)
)

def pronoun(self, **kwargs) -> str:
"""Returns an objective pronoun as appropriate, based on attributes.
Expand Down

0 comments on commit 151476f

Please sign in to comment.