Exemplo n.º 1
0
 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("/"))
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 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("/"))
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
 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("/"))
Exemplo n.º 6
0
 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("/"))
Exemplo n.º 7
0
 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
Exemplo n.º 8
0
 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
Exemplo n.º 9
0
 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("/"))
Exemplo n.º 10
0
 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("/"))