def to_frame(self): if not self.children and not self.allow_empty_frame: return frame = CreateFrame(if_clause=self.if_clause) for child in self.children: if isinstance(child, CommandId): frame.add_command(XPath.string(child.id)) elif isinstance(child, StackDatum): frame.add_datum(child) else: raise Exception("Unexpected child type: {} ({})".format(type(child), child)) return frame
def to_frame(self): if not self.children and not self.allow_empty_frame: return frame = CreateFrame(if_clause=self.if_clause) for child in self.children: if isinstance(child, CommandId): frame.add_command(XPath.string(child.id)) elif isinstance(child, StackDatum): frame.add_datum(child) else: raise Exception("Unexpected child type: {} ({})".format( type(child), child)) return frame
def to_frame(self): if not self.children and not self.allow_empty_frame: return children = _replace_session_references_in_stack( self.children, current_session=self.current_session) frame = CreateFrame(if_clause=self.if_clause) for child in children: if isinstance(child, CommandId): frame.add_command(child.to_command()) elif isinstance(child, (StackDatum, StackQuery)): frame.add_datum(child) else: raise SuiteError("Unexpected child type: {} ({})".format( type(child), child)) return frame
def get_module_contributions(self, module): if module_offers_search(module): domain = self.app.domain details_helper = DetailsHelper(self.app) remote_request = RemoteRequest( post=RemoteRequestPost( url=absolute_reverse('claim_case', args=[domain]), relevant=module.search_config.relevant, data=[ QueryData( key='case_id', ref=QuerySessionXPath('case_id').instance(), # e.g. instance('querysession')/session/data/case_id ), ]), command=Command( id=id_strings.search_command(module), display=Display(text=Text( locale_id=id_strings.case_search_locale(module)), ), ), instances=[ Instance(id=SESSION_INSTANCE, src='jr://instance/session'), Instance(id='casedb', src='jr://instance/casedb'), ], session=RemoteRequestSession( queries=[ RemoteRequestQuery( url=absolute_reverse('remote_search', args=[domain]), storage_instance=RESULTS_INSTANCE, data=[ QueryData(key='case_type', ref="'{}'".format(module.case_type)), ], prompts=[ QueryPrompt( key=p.name, display=Display( text=Text(locale_id=id_strings. search_property_locale( module, p.name)), ), ) for p in module.search_config.properties ]) ], data=[ SessionDatum( id='case_id', nodeset=(CaseTypeXpath(module.case_type).case( instance_name=RESULTS_INSTANCE).select( u'@status', u'open', quote=True)), value='./@case_id', detail_select=details_helper.get_detail_id_safe( module, 'case_short'), detail_confirm=details_helper.get_detail_id_safe( module, 'case_long'), ) ], ), stack=Stack(), ) frame = CreateFrame() # Open first form in module frame.add_command(XPath.string(id_strings.menu_id(module))) frame.add_datum( StackDatum(id='case_id', value=QuerySessionXPath('case_id').instance())) remote_request.stack.add_frame(frame) return [remote_request] return []