def getMultipleData(self, name, identifiers, **kwargs):
        identifiers = list(identifiers)
        erfgeoEnrichments = self.call.getMultipleData(identifiers=identifiers, name='erfGeoEnrichment', **kwargs)
        if name == ERFGEO_ENRICHMENT_PROFILE.prefix:
            return erfgeoEnrichments
        elif name != COMBINED_METADATA_PREFIX:
            raise ValueError('unsupported name %s' % name)

        summaryIdentifiers = [
            SUMMARY_PROFILE.uriFor(ERFGEO_ENRICHMENT_PROFILE.targetUriFrom(identifier))
            for identifier
            in identifiers
        ]
        summaries = dict(self.call.getMultipleData(identifiers=summaryIdentifiers, name=SUMMARY_PROFILE.prefix, **kwargs))
        return (
            (
                erfGeoEnrichmentUri,
                asString(
                    self._combine(
                        erfgeoEnrichmentData,
                        summaries[SUMMARY_PROFILE.uriFor(ERFGEO_ENRICHMENT_PROFILE.targetUriFrom(erfGeoEnrichmentUri))]
                    )
                )
            )
            for erfGeoEnrichmentUri, erfgeoEnrichmentData
            in erfgeoEnrichments
        )
Esempio n. 2
0
 def handleRequest(self, arguments, **kwargs):
     uri = arguments['uri'][0]
     summaryUri = SUMMARY_PROFILE.uriFor(uri)
     print 'uri', uri, 'summaryUri', summaryUri
     from sys import stdout; stdout.flush()
     data = self.call.getData(identifier=summaryUri, name=SUMMARY_PROFILE.prefix)
     yield 'HTTP/1.0 200 OK' + CRLF
     yield 'Content-Type: application/xml' + CRLF
     yield CRLF
     yield data
 def testDelete(self):
     summaryToErfGeoEnrichment = SummaryToErfGeoEnrichment()
     observer = CallTrace('observer')
     top = be(
         (Observable(),
             (summaryToErfGeoEnrichment,
                 (observer,)
             )
         )
     )
     targetUri = 'target:uri'
     consume(top.all.delete(identifier=SUMMARY_PROFILE.uriFor(targetUri)))
     self.assertEquals(['delete'], observer.calledMethodNames())
     self.assertEquals(ERFGEO_ENRICHMENT_PROFILE.uriFor(targetUri), observer.calledMethods[0].kwargs['identifier'])
 def delete(self, identifier):
     summaryUri = identifier
     targetUri = SUMMARY_PROFILE.targetUriFrom(summaryUri)
     annotationUri = ERFGEO_ENRICHMENT_PROFILE.uriFor(targetUri)
     yield self.all.delete(identifier=annotationUri)