Exemplo n.º 1
0
 def _writeEchoedSearchRetrieveRequest(self, sruArguments, **kwargs):
     yield '<srw:echoedSearchRetrieveRequest>'
     for paramSets in ECHOED_PARAMETER_NAMES, self._extraXParameters:
         for parameterName in paramSets:
             value = sruArguments.get(parameterName, [])
             for v in (value if isinstance(value, list) else [value]):
                 aValue = xmlEscape(str(v))
                 yield '<srw:%(parameterName)s>%(aValue)s</srw:%(parameterName)s>' % locals()
     for chunk in decorate('<srw:extraRequestData>', compose(self.all.echoedExtraRequestData(sruArguments=sruArguments, **kwargs)), '</srw:extraRequestData>'):
         yield chunk
     yield '</srw:echoedSearchRetrieveRequest>'
Exemplo n.º 2
0
 def _writeEchoedSearchRetrieveRequest(self, sruArguments, **kwargs):
     yield '<srw:echoedSearchRetrieveRequest>'
     for paramSets in ECHOED_PARAMETER_NAMES, self._extraXParameters:
         for parameterName in paramSets:
             value = sruArguments.get(parameterName, [])
             for v in (value if isinstance(value, list) else [value]):
                 aValue = xmlEscape(str(v))
                 yield '<srw:%(parameterName)s>%(aValue)s</srw:%(parameterName)s>' % locals()
     for chunk in decorate('<srw:extraRequestData>', compose(self.all.echoedExtraRequestData(sruArguments=sruArguments, **kwargs)), '</srw:extraRequestData>'):
         yield chunk
     yield '</srw:echoedSearchRetrieveRequest>'
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
 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
Exemplo n.º 5
0
 def testAlternativePeekEmpty(self):
     result = list(decorate(1, (i for i in []), 3))
     self.assertEqual([], result)
Exemplo n.º 6
0
 def testAlternativePeekEmpty(self):
     result = list(decorate(1, (i for i in []), 3))
     self.assertEquals([], result)