fixed error text display, added todo for tests
This commit is contained in:
parent
c868f6ef23
commit
a03262a3fd
|
|
@ -38,7 +38,7 @@ class ExportManager:
|
||||||
def __call__(self, export_request):
|
def __call__(self, export_request):
|
||||||
return self.transform(export_request)
|
return self.transform(export_request)
|
||||||
|
|
||||||
def transform(self, export_request):
|
def transform(self, export_request): # TODO: test all return values
|
||||||
"""
|
"""
|
||||||
Transformation function to magically poof ExportRequest tuples into
|
Transformation function to magically poof ExportRequest tuples into
|
||||||
ExportResponse tuples using the loaded config.
|
ExportResponse tuples using the loaded config.
|
||||||
|
|
@ -60,13 +60,13 @@ class ExportManager:
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
start, end = self.templates["bootstrap"][export_request.type][export_request.subtype]
|
start, end = self.templates["bootstrap"][export_request.type][export_request.subtype]
|
||||||
except KeyError:
|
except KeyError: # TODO: Test this in-depth
|
||||||
log_entries = ["bootstrap", export_request.type, export_request.subtype]
|
log_entries = ["bootstrap", export_request.type, export_request.subtype]
|
||||||
log_ = error_mngr.dict_check(self.templates, *log_entries)
|
log_ = error_mngr.dict_check(self.templates, *log_entries)
|
||||||
print()
|
print()
|
||||||
error_mngr.log_exception(
|
error_mngr.log_exception(
|
||||||
KeyError(
|
KeyError(
|
||||||
f'Template "bootstrap"/{export_request.type}/{export_request.subtype} could not be found.'
|
f'Template "bootstrap"/{export_request.type}/{export_request.subtype} could not be found.\n' +
|
||||||
'\n'.join([f'{i}: {"Found" if j else "Not found"}' for i, j in zip(log_entries, log_)])
|
'\n'.join([f'{i}: {"Found" if j else "Not found"}' for i, j in zip(log_entries, log_)])
|
||||||
),
|
),
|
||||||
level='CRITICAL'
|
level='CRITICAL'
|
||||||
|
|
@ -135,4 +135,5 @@ class ExportManager:
|
||||||
|
|
||||||
if __name__ == '__main__': # pragma: no cover
|
if __name__ == '__main__': # pragma: no cover
|
||||||
herbert = ExportManager(cnoifg=None, templates=None)
|
herbert = ExportManager(cnoifg=None, templates=None)
|
||||||
herbert._get_template(ExportRequest('b', 'c', 'class="hugues"')) # noqa
|
# herbert._get_template(ExportRequest('b', 'c', 'class="hugues"')) # noqa
|
||||||
|
print(herbert.transform(ExportRequest('structural_elements', 'div', 'class="card"')))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue