コード例 #1
0
 def build_stack(self):
     stack = Stack()
     rewind_if = None
     if module_uses_smart_links(self.module):
         user_domain_xpath = session_var(COMMCARE_PROJECT, path="user/data")
         # For case in same domain, do a regular case claim rewind
         rewind_if = self._get_case_domain_xpath().eq(user_domain_xpath)
         # For case in another domain, jump to that other domain
         frame = PushFrame(if_clause=XPath.not_(rewind_if))
         frame.add_datum(
             StackJump(url=Text(xpath=TextXPath(
                 function=self.get_smart_link_function(),
                 variables=self.get_smart_link_variables(),
             ), ), ))
         stack.add_frame(frame)
     frame = PushFrame(if_clause=rewind_if)
     frame.add_rewind(QuerySessionXPath(self.case_session_var).instance())
     stack.add_frame(frame)
     return stack
コード例 #2
0
ファイル: test_xpath.py プロジェクト: saketkanth/commcare-hq
 def test_not(self):
     self.assertEqual('not a', XPath.not_('a'))
     self.assertEqual('not (a or b)', XPath.not_(XPath.or_('a', 'b')))
コード例 #3
0
ファイル: test_xpath.py プロジェクト: ye-man/commcare-hq
 def test_not(self):
     self.assertEqual('not a', XPath.not_('a'))
     self.assertEqual('not (a or b)', XPath.not_(XPath.or_('a', 'b')))