def _get_counters(objects): topic_counts = Counter() language_counts = Counter() for object in objects: if object.topics: for topic in object.topics: topic_counts[topic] += 1 language_counts[object.language] += 1 langs = [(code, languages.show(code)) for code in language_counts] langs.sort(key=lambda x: (-language_counts[x[0]], x[1])) return {"topic_counts": topic_counts, "language_counts": language_counts}
def show_lang_topics(self): if self.language and self.language != "en": language = '<span class="language_label">%s</span>' % languages.show( self.language) else: language = "" if self.topics: return language + "".join( '<span class="topic_label">%s</span>' % topic for topic in topic_dag.leaves(self.topics)) else: return language
def show_lang_topics(self): if self.language and self.language != "en": language = '<span class="language_label">%s</span>' % languages.show(self.language) else: language = "" if self.topics: try: return language + "".join('<span class="topic_label">%s</span>' % topic for topic in topic_dag.leaves(self.topics)) except Exception as err: log_error("Hit exception %s in show_lang_topics for talk %s/%d" % (err, self.seminar_id, self.seminar_ctr)) return language else: return language