def extraResponseData(self, drilldownData, sruArguments, **kwargs): if drilldownData is None: return outputFormat = sruArguments.get('x-drilldown-format', [self._defaultFormat])[0] drilldownHeader = _DRILLDOWN_HEADER % (_DRILLDOWN_XSD_2007 if outputFormat == FORMAT_OLD_XML else _DRILLDOWN_XSD_2013) try: yield decorate(drilldownHeader, self._termDrilldown(drilldownData, format=outputFormat), DRILLDOWN_FOOTER) except Exception as e: print_exc() yield drilldownHeader + "<dd:term-drilldown>" yield generalSystemError(xmlEscape(e.args[0])) yield "</dd:term-drilldown>" + DRILLDOWN_FOOTER return
def extraResponseData(self, drilldownData, sruArguments, **kwargs): if drilldownData is None: return outputFormat = sruArguments.get('x-drilldown-format', [self._defaultFormat])[0] drilldownHeader = _DRILLDOWN_HEADER % (_DRILLDOWN_XSD_2007 if outputFormat == FORMAT_OLD_XML else _DRILLDOWN_XSD_2013) try: yield decorate(drilldownHeader, self._termDrilldown(drilldownData, format=outputFormat), DRILLDOWN_FOOTER) except Exception, e: print_exc() yield drilldownHeader + "<dd:term-drilldown>" yield generalSystemError(xmlEscape(e.args[0])) yield "</dd:term-drilldown>" + DRILLDOWN_FOOTER return
def _dd_navigator(self, fieldname, terms): try: firstTerm = terms[0] yield '<dd:navigator name=%s>' % quoteattr(fieldname) yield self._dd_item(firstTerm) for term in terms[1:]: yield self._dd_item(term) yield '</dd:navigator>' except IndexError: yield '<dd:navigator name=%s/>' % quoteattr(fieldname) return except Exception as e: print_exc() yield generalSystemError(xmlEscape(str(e))) return
def _dd_navigator(self, fieldname, terms): try: firstTerm = terms[0] yield '<dd:navigator name=%s>' % quoteattr(fieldname) yield self._dd_item(firstTerm) for term in terms[1:]: yield self._dd_item(term) yield '</dd:navigator>' except IndexError: yield '<dd:navigator name=%s/>' % quoteattr(fieldname) return except Exception, e: print_exc() yield generalSystemError(xmlEscape(str(e))) return