src/pyams_thesaurus/zmi/widget/__init__.py
changeset 78 8bab1101f4ef
parent 77 5eb2f0ff9ba3
child 87 dfe19304d980
equal deleted inserted replaced
77:5eb2f0ff9ba3 78:8bab1101f4ef
   176 class ThesaurusTermsTreeWidget(ThesaurusTermsListWidget):
   176 class ThesaurusTermsTreeWidget(ThesaurusTermsListWidget):
   177     """Thesaurus terms tree widget"""
   177     """Thesaurus terms tree widget"""
   178 
   178 
   179     @property
   179     @property
   180     def top_terms(self):
   180     def top_terms(self):
   181         thesaurus = query_utility(IThesaurus, name=self.thesaurus_name)
   181         thesaurus = query_utility(IThesaurus, name=self.thesaurus_name or '')
   182         if thesaurus is not None:
   182         if thesaurus is not None:
   183             return sorted(thesaurus.get_top_terms(extract=self.extract_name),
   183             return sorted(thesaurus.get_top_terms(extract=self.extract_name),
   184                           key=lambda x: x.label)
   184                           key=lambda x: x.label)
   185         else:
   185         else:
   186             return ()
   186             return ()