def get_data(self, path): """ Evaluates an xpath expression like: path/to/node and returns the value of that element, or None if there is no value. :param path: xpath like expression """ return safe_index({'form': self.form_data}, path.split("/"))
def submission_or_completion_time(self): time = iso_string_to_datetime(safe_index(self.form, self.report.time_field.split('.'))) if self.report.by_submission_time: user_time = ServerTime(time).user_time(self.report.timezone) else: user_time = PhoneTime(time, self.report.timezone).user_time(self.report.timezone) return user_time.ui_string(USER_DATETIME_FORMAT_WITH_SEC)
def xpath(self, path): """ Evaluates an xpath expression like: path/to/node and returns the value of that element, or None if there is no value. """ _soft_assert = soft_assert(to='{}@{}'.format('brudolph', 'dimagi.com')) _soft_assert(False, "Reference to xpath instead of get_data") return safe_index(self, path.split("/"))
def _filter(res): if self.filters: for path, val in self.filters.items(): actual_val = safe_index(res.case_json, path.split("/")) if actual_val != val: # closed=false => case.closed == False if val in ('null', 'true', 'false'): if actual_val != json.loads(val): return False else: return False return True
def xpath(self, path): """ Evaluates an xpath expression like: path/to/node and returns the value of that element, or None if there is no value. """ return safe_index(self, path.split("/"))
def get_data(self, path): """ Evaluates an xpath expression like: path/to/node and returns the value of that element, or None if there is no value. """ return safe_index(self, path.split("/"))