Open nonprofittechy opened 4 months ago
I ran into this problem again, and it came up when doing the logic for unlawful detainer notice defense. I think this is the problem in defenses.py
if is_mobile_home_owner:
# Proper date is at least 60 days after the upcoming rent day, but need not end on a rent day
# Calculate the next rent due date from the received notice date
next_rent_due_date = received_notice_date.replace(day=rent_day).plus(months=1)
# Calculate the earliest proper termination date for this scenario
earliest_proper_termination_date = next_rent_due_date.plus(days=60)
if notice_to_terminate_includes_specific_day == "rental_period":
termination_of_tenancy_date = end_of_next_rental_period(received_notice_date, rent_day, rent_period)
# else: termination_of_tenancy_date is already set to a specific date
# True means notice is improper
return termination_of_tenancy_date < earliest_proper_termination_date
In my test, is_mobile_home_owner
= True and notice_to_terminate_includes_specific_day
== "no_specific_day" and termination_of_tenancy_date
is not defined (because it is only asked if notice_to_terminate_includes_specific_day
== "specific_day"
@nonprofittechy Maybe a good solution for this would be to pull in petition_date
- if the petition date is before the earliest proper termination date, this defense would work
That sounds like a good solution!
I accidentally commited the fix to main. I also got changed filing_date to petition_date in the review block, and made the interview always ask about the filing date.
File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/AssemblyLine/al_document.py", line 1646, in
if document.is_enabled(refresh=refresh)
File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/AssemblyLine/al_document.py", line 1261, in is_enabled
self.cache.enabled = self.enabled
File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/base/util.py", line 942, in getattr
raise docassemble.base.functions.this_thread.misc['pending_error']
docassemble.base.error.DAAttributeError: name 'motion_to_shorten_time_attachment.enabled' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/flask/app.py", line 1455, in wsgi_app response = self.full_dispatch_request() File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/flask/app.py", line 869, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/flask/app.py", line 759, in handle_user_exception return self.ensure_sync(handler)(e) File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/webapp/server.py", line 23313, in server_error return index(action_argument={'action': docassemble.base.functions.this_thread.interview.consolidated_metadata['error action'], 'arguments': {'error_message': orig_errmess, 'error_history': the_history, 'error_trace': the_trace}}, refer=['error']) File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/webapp/server.py", line 6989, in index interview.assemble(user_dict, interview_status=interview_status) File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/base/parse.py", line 9019, in assemble raise the_error File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/base/parse.py", line 8806, in assemble question_result = self.askfor(missingVariable, user_dict, old_user_dict, interview_status, seeking=interview_status.seeking, follow_mc=follow_mc, seeking_question=seeking_question) File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/base/parse.py", line 9646, in askfor question_result = self.askfor(newMissingVariable, user_dict, old_user_dict, interview_status, variable_stack=variable_stack, questions_tried=questions_tried, seeking=seeking, follow_mc=follow_mc, recursion_depth=recursion_depth, seeking_question=seeking_question) File "/usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble/base/parse.py", line 9568, in askfor raise DAErrorMissingVariable("Interview has an error. There was a reference to a variable '" + origMissingVariable + "' that could not be looked up in the question file (for language '" + str(language) + "') or in any of the files incorporated by reference into the question file.", variable=origMissingVariable) docassemble.base.error.DAErrorMissingVariable: Interview has an error. There was a reference to a variable 'motion_to_shorten_time_attachment.enabled' that could not be looked up in the question file (for language 'en') or in any of the files incorporated by reference into the question file.
We ran into this error when using Fake Filler with background variables available. Maybe we need more checks on dates before we try to use them, or try/except when doing date comparisons? Or maybe this isn't an error a real user could run into.
It's not exactly clear which date comparison caused the problem, but there are only a few of them.