diff --git a/expert/browser/configure.zcml b/expert/browser/configure.zcml index f88c9c3..5dadb3a 100644 --- a/expert/browser/configure.zcml +++ b/expert/browser/configure.zcml @@ -75,4 +75,20 @@ class="loops.expert.browser.report.ResultsView" permission="zope.View" /> + + + + diff --git a/expert/browser/report.py b/expert/browser/report.py index 3883238..002a950 100644 --- a/expert/browser/report.py +++ b/expert/browser/report.py @@ -137,9 +137,6 @@ class ResultsConceptView(ConceptView): """ View on a concept using the results of a report. """ - reportName = None # define in subclass if applicable - reportType = None # set for using special report instance adapter - @Lazy def result_macros(self): return self.controller.getTemplateMacros('results', results_template) @@ -157,12 +154,22 @@ class ResultsConceptView(ConceptView): def hasReportPredicate(self): return self.conceptManager['hasreport'] + @Lazy + def reportName(self): + return (self.getOptions('report_name') or [None])[0] + + @Lazy + def reportType(self): + return (self.getOptions('report_type') or [None])[0] + @Lazy def report(self): if self.reportName: return adapted(self.conceptManager[self.reportName]) - type = self.context.conceptType - reports = type.getParents([self.hasReportPredicate]) + reports = self.context.getParents([self.hasReportPredicate]) + if not reports: + type = self.context.conceptType + reports = type.getParents([self.hasReportPredicate]) return adapted(reports[0]) @Lazy diff --git a/expert/configure.zcml b/expert/configure.zcml index 68c5d79..23dbd7f 100644 --- a/expert/configure.zcml +++ b/expert/configure.zcml @@ -38,6 +38,10 @@ set_schema="loops.expert.report.IReportInstance" /> + +