Fixes #2312: Running a report yields a ValueError exception

This commit is contained in:
Jeremy Stretch 2018-08-07 09:12:05 -04:00
parent 1905516536
commit c7acddbc5c
3 changed files with 3 additions and 4 deletions

1
netbox/_reports Submodule

@ -0,0 +1 @@
Subproject commit b3a449437792668041d5cfb9cd6d025e1a5b3470

View File

@ -16,16 +16,14 @@ def is_report(obj):
"""
Returns True if the given object is a Report.
"""
if obj in Report.__subclasses__():
return True
return False
return obj in Report.__subclasses__()
def get_report(module_name, report_name):
"""
Return a specific report from within a module.
"""
module = importlib.import_module('reports.{}'.format(module_name))
module = importlib.import_module(module_name)
report = getattr(module, report_name, None)
if report is None:
return None