def update_property(self, response): """ update the property of an instance from a response if the metadatas field if present """ if response.HasField(b"metadatas") and response.publication_date != self.publication_date: with self.lock as lock: if response.metadatas.shape and response.metadatas.shape != "": try: self.geom = wkt.loads(response.metadatas.shape) except ReadingError: self.geom = None self.is_up = True else: self.geom = None self.timezone = response.metadatas.timezone set_request_instance_timezone(self)
def update_property(self, response): """ update the property of an instance from a response if the metadatas field if present """ #after a successful call we consider the instance initialised even if no data were loaded self.is_initialized = True if response.HasField(str("metadatas")) and response.publication_date != self.publication_date: logging.getLogger(__name__).debug('updating metadata for %s', self.name) with self.lock as lock: self.publication_date = response.publication_date if response.metadatas.shape and response.metadatas.shape != "": try: self.geom = wkt.loads(response.metadatas.shape) except ReadingError: self.geom = None else: self.geom = None self.timezone = response.metadatas.timezone set_request_instance_timezone(self)