-
Notifications
You must be signed in to change notification settings - Fork 19
Closed
Description
The parser fails with an unhandled AttributeError on the following: '7 Jun-14 Jul 1916'. It looks like the issue is that the lower and upper bounds are both lists. I'm expecting EDTFParseExceptions, but not Attribute errors.
Code to replicate: (edtf=4.0.1, python = 3.6)
import edtf
parsed_date_string = edtf.text_to_edtf('7 Jun-14 Jul 1916') # 'uuuu-06-07/1916-07-14'
parsed_date = edtf.parse_edtf(parsed_date_string) # [PartialUnspecified: 'uuuu-06-07']/[Date: '1916-07-14']
lower = parsed_date.lower_strict()
Exception thrown:
AttributeError Traceback (most recent call last)
~/Code/silo_indexer/.venv/lib/python3.6/site-packages/edtf/parser/parser_classes.py in _strict_date(self, lean)
350 try:
--> 351 r = self.lower._strict_date(lean)
352 if r is None:
AttributeError: 'list' object has no attribute '_strict_date'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
<ipython-input-7-1bed0c797cc0> in <module>
2 parsed_date_string = edtf.text_to_edtf('7 Jun-14 Jul 1916') # 'uuuu-06-07/1916-07-14'
3 parsed_date = edtf.parse_edtf(parsed_date_string) # [PartialUnspecified: 'uuuu-06-07']/[Date: '1916-07-14']
----> 4 lower = parsed_date.lower_strict()
~/Code/silo_indexer/.venv/lib/python3.6/site-packages/edtf/parser/parser_classes.py in lower_strict(self)
126
127 def lower_strict(self):
--> 128 return self._strict_date(lean=EARLIEST)
129
130 def upper_strict(self):
~/Code/silo_indexer/.venv/lib/python3.6/site-packages/edtf/parser/parser_classes.py in _strict_date(self, lean)
354 return r
355 except AttributeError: # it's a string, or no date. Result depends on the upper date
--> 356 upper = self.upper._strict_date(LATEST)
357 return apply_delta(sub, upper, appsettings.DELTA_IF_UNKNOWN)
358 else:
AttributeError: 'list' object has no attribute '_strict_date'
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels