def locationChangeSubscriber(obj, event): log.debug("Event handled: %s, %s", obj, event) # Reindex co-temporal names of the parent place since they are being # localized by this location. place = aq_parent(aq_inner(obj)) for o in filter( lambda x: temporal_overlap(obj, x), place.getNames() ): o.reindexObject() reindexContainer(obj, event)
def __init__(self, context): """Initialize adapter.""" self.context = context self.geo = None x = [] place = self.context.aq_parent for o in filter(lambda x: temporal_overlap(self.context, x), place.getLocations()): try: x.append(IGeoreferenced(o)) except ValueError: continue if len(x) > 0: self.geo = self._geo(x) else: geo_parts = [] for ob in self.context.getFeatures(): geo_parts.append(IGeoreferenced(ob)) if geo_parts: self.geo = self._geo(geo_parts) if self.geo is None: raise NotLocatedError("Location cannot be determined")
def __init__(self, context): """Initialize adapter.""" self.context = context self.geo = None x = [] place = self.context.aq_parent for o in filter( lambda x: temporal_overlap(self.context, x), place.getLocations()): try: x.append(IGeoreferenced(o)) except ValueError: continue if len(x) > 0: self.geo = self._geo(x) else: geo_parts = [] for ob in self.context.getFeatures(): geo_parts.append(IGeoreferenced(ob)) if geo_parts: self.geo = self._geo(geo_parts) if self.geo is None: raise NotLocatedError("Location cannot be determined")
def test_overlap(self): p = MockTemporalContent([{"timePeriod": "roman"}]) q = MockTemporalContent([{"timePeriod": "roman"}]) self.failUnless(temporal_overlap(p, q, VOCAB))
def test_nonoverlap(self): p = MockTemporalContent([{"timePeriod": "hellenistic-republican"}]) q = MockTemporalContent([{"timePeriod": "roman"}]) self.failIf(temporal_overlap(p, q, VOCAB))
def test_overlap(self): p = MockTemporalContent([{'timePeriod': 'roman'}]) q = MockTemporalContent([{'timePeriod': 'roman'}]) ranges = periodRanges(VOCAB) self.failUnless(temporal_overlap(p, q, ranges))
def test_nonoverlap(self): p = MockTemporalContent([{'timePeriod': 'hellenistic-republican'}]) q = MockTemporalContent([{'timePeriod': 'roman'}]) ranges = periodRanges(VOCAB) self.failIf(temporal_overlap(p, q, ranges))