def _get_bib_data( q_results ): """ Takes solrpy query-object results. Calls bib lookups. Returns tuple of lookup data. Called by _prepare_viewinscr_get_data(). TODO: move into models or common. """ # log.debug( u'in _get_bib_data(); q_results, %s' % pprint.pformat(q_results) ) bibs = common.fetchBiblio( q_results, 'bibl') bibDip = common.fetchBiblio( q_results, 'biblDiplomatic') bibTsc = common.fetchBiblio( q_results, 'biblTranscription') bibTrn = common.fetchBiblio( q_results, 'biblTranslation') return_tuple = ( bibs, bibDip, bibTsc, bibTrn ) # log.debug( u'in _get_bib_data(); return_tuple, %s' % pprint.pformat(return_tuple) ) return return_tuple
def _get_bib_data(q_results): """ Takes solrpy query-object results. Calls bib lookups. Returns tuple of lookup data. Called by _prepare_viewinscr_get_data(). TODO: move into models or common. """ # log.debug( u'in _get_bib_data(); q_results, %s' % pprint.pformat(q_results) ) bibs = common.fetchBiblio(q_results, 'bibl') bibDip = common.fetchBiblio(q_results, 'biblDiplomatic') bibTsc = common.fetchBiblio(q_results, 'biblTranscription') bibTrn = common.fetchBiblio(q_results, 'biblTranslation') return_tuple = (bibs, bibDip, bibTsc, bibTrn) # log.debug( u'in _get_bib_data(); return_tuple, %s' % pprint.pformat(return_tuple) ) return return_tuple
def test_fetchBiblio( self ): """ Checks biblio solr response for a given iip solr resultset and target-string. """ s = solr.SolrConnection( settings_app.SOLR_URL ) qstring = u'inscription_id:%s' % u'beth0282' q = s.query( qstring ) result = common.fetchBiblio( q_results=q.results, target=u'biblTranslation'.encode(u'utf-8') ) self.assertEqual( list, type(result) ) self.assertEqual( 1, len(result) ) self.assertEqual( dict, type( result[0] ) ) self.assertEqual( 23, len( result[0].keys() ) ) self.assertEqual( [u'biblioId', u'publisher_place_t', u'subject_facet', u'subject_geographic_t'], sorted( result[0].keys()[0:4] ) )