def get_datum_meta_module(self, module, use_filter=False): datums = [] datum_module = module.source_module if module.module_type == "shadow" else module datums_meta = get_select_chain_meta(self.app, datum_module) for i, datum in enumerate(datums_meta): # get the session var for the previous datum if there is one parent_id = datums_meta[i - 1]["session_var"] if i >= 1 else "" if parent_id: parent_filter = EntriesHelper.get_parent_filter(datum["module"].parent_select.relationship, parent_id) else: parent_filter = "" detail_module = module if module.module_type == "shadow" else datum["module"] detail_persistent, detail_inline = self.get_case_tile_datum_attrs(datum["module"], detail_module) fixture_select_filter = "" if datum["module"].fixture_select.active: datums.append( FormDatumMeta( datum=SessionDatum( id=id_strings.fixture_session_var(datum["module"]), nodeset=ItemListFixtureXpath(datum["module"].fixture_select.fixture_type).instance(), value=datum["module"].fixture_select.variable_column, detail_select=id_strings.fixture_detail(detail_module), ), case_type=None, requires_selection=True, action="fixture_select", ) ) filter_xpath_template = datum["module"].fixture_select.xpath fixture_value = session_var(id_strings.fixture_session_var(datum["module"])) fixture_select_filter = "[{}]".format(filter_xpath_template.replace("$fixture_value", fixture_value)) filter_xpath = EntriesHelper.get_filter_xpath(module) if use_filter else "" datums.append( FormDatumMeta( datum=SessionDatum( id=datum["session_var"], nodeset=( EntriesHelper.get_nodeset_xpath(datum["case_type"], filter_xpath=filter_xpath) + parent_filter + fixture_select_filter ), value="./@case_id", detail_select=self.details_helper.get_detail_id_safe(detail_module, "case_short"), detail_confirm=( self.details_helper.get_detail_id_safe(detail_module, "case_long") if datum["index"] == 0 and not detail_inline else None ), detail_persistent=detail_persistent, detail_inline=detail_inline, ), case_type=datum["case_type"], requires_selection=True, action="update_case", ) ) return datums
def get_datum_meta_module(self, module, use_filter=False): datums = [] datum_module = module.source_module if module.module_type == 'shadow' else module datums_meta = get_select_chain_meta(self.app, datum_module) for i, datum in enumerate(datums_meta): # get the session var for the previous datum if there is one parent_id = datums_meta[i - 1]['session_var'] if i >= 1 else '' if parent_id: parent_filter = EntriesHelper.get_parent_filter( datum['module'].parent_select.relationship, parent_id ) else: parent_filter = '' detail_module = module if module.module_type == 'shadow' else datum['module'] detail_persistent = self.get_detail_persistent_attr(datum['module'], detail_module, "case_short") detail_inline = self.get_detail_inline_attr(datum['module'], detail_module, "case_short") fixture_select_filter = '' if datum['module'].fixture_select.active: datums.append(FormDatumMeta( datum=SessionDatum( id=id_strings.fixture_session_var(datum['module']), nodeset=ItemListFixtureXpath(datum['module'].fixture_select.fixture_type).instance(), value=datum['module'].fixture_select.variable_column, detail_select=id_strings.fixture_detail(detail_module) ), case_type=None, requires_selection=True, action='fixture_select' )) filter_xpath_template = datum['module'].fixture_select.xpath fixture_value = session_var(id_strings.fixture_session_var(datum['module'])) fixture_select_filter = "[{}]".format( filter_xpath_template.replace('$fixture_value', fixture_value) ) filter_xpath = EntriesHelper.get_filter_xpath(detail_module) if use_filter else '' datums.append(FormDatumMeta( datum=SessionDatum( id=datum['session_var'], nodeset=(EntriesHelper.get_nodeset_xpath(datum['case_type'], filter_xpath=filter_xpath) + parent_filter + fixture_select_filter), value="./@case_id", detail_select=self.details_helper.get_detail_id_safe(detail_module, 'case_short'), detail_confirm=( self.details_helper.get_detail_id_safe(detail_module, 'case_long') if datum['index'] == 0 and not detail_inline else None ), detail_persistent=detail_persistent, detail_inline=detail_inline, autoselect=datum['module'].auto_select_case, ), case_type=datum['case_type'], requires_selection=True, action='update_case' )) return datums
def get_datum_meta_module(self, module, use_filter=False): datums = [] datum_module = module.source_module if module.module_type == 'shadow' else module datums_meta = get_select_chain_meta(self.app, datum_module) for i, datum in enumerate(datums_meta): # get the session var for the previous datum if there is one parent_id = datums_meta[i - 1]['session_var'] if i >= 1 else '' if parent_id: parent_filter = EntriesHelper.get_parent_filter( datum['module'].parent_select.relationship, parent_id ) else: parent_filter = '' # Figure out which module will supply the details (select, confirm, etc.) # for this datum. Normally this is the datum's own module. detail_module = datum['module'] # Shadow modules are different because datums_meta is generated based on the source module, # but the various details should be supplied based on the shadow's own configuration. if module.module_type == 'shadow': if datum['module'].unique_id == module.source_module_id: # We're looking at the datum that corresponds to the original module, # so use that module for details detail_module = module else: # Check for case list parent child selection. If both shadow and source use parent case # selection, datums_meta will contain a datum for the parent case, based on the SOURCE's # parent select, and when we see that datum, we need to use the SHADOW's parent select # to supply the details. shadow_active = hasattr(module, 'parent_select') and module.parent_select.active source_active = hasattr(datum_module, 'parent_select') and datum_module.parent_select.active if shadow_active and source_active: if datum['module'].unique_id == datum_module.parent_select.module_id: detail_module = self.app.get_module_by_unique_id(module.parent_select.module_id) detail_persistent = self.get_detail_persistent_attr(datum['module'], detail_module, "case_short") detail_inline = self.get_detail_inline_attr(datum['module'], detail_module, "case_short") fixture_select_filter = '' if datum['module'].fixture_select.active: datums.append(FormDatumMeta( datum=SessionDatum( id=id_strings.fixture_session_var(datum['module']), nodeset=ItemListFixtureXpath(datum['module'].fixture_select.fixture_type).instance(), value=datum['module'].fixture_select.variable_column, detail_select=id_strings.fixture_detail(detail_module) ), case_type=None, requires_selection=True, action='fixture_select' )) filter_xpath_template = datum['module'].fixture_select.xpath fixture_value = session_var(id_strings.fixture_session_var(datum['module'])) fixture_select_filter = "[{}]".format( filter_xpath_template.replace('$fixture_value', fixture_value) ) filter_xpath = EntriesHelper.get_filter_xpath(detail_module) if use_filter else '' datums.append(FormDatumMeta( datum=SessionDatum( id=datum['session_var'], nodeset=(EntriesHelper.get_nodeset_xpath(datum['case_type'], filter_xpath=filter_xpath) + parent_filter + fixture_select_filter), value="./@case_id", detail_select=self.details_helper.get_detail_id_safe(detail_module, 'case_short'), detail_confirm=( self.details_helper.get_detail_id_safe(detail_module, 'case_long') if datum['index'] == 0 and not detail_inline else None ), detail_persistent=detail_persistent, detail_inline=detail_inline, autoselect=datum['module'].auto_select_case, ), case_type=datum['case_type'], requires_selection=True, action='update_case' )) return datums
def get_datum_meta_module(self, module, use_filter=False): datums = [] datum_module = module.source_module if module.module_type == 'shadow' else module datums_meta = get_select_chain_meta(self.app, datum_module) for i, datum in enumerate(datums_meta): # get the session var for the previous datum if there is one parent_id = datums_meta[i - 1]['session_var'] if i >= 1 else '' if parent_id: parent_filter = EntriesHelper.get_parent_filter( datum['module'].parent_select.relationship, parent_id ) else: parent_filter = '' # Figure out which module will supply the details (select, confirm, etc.) # for this datum. Normally this is the datum's own module. detail_module = datum['module'] # Shadow modules are different because datums_meta is generated based on the source module, # but the various details should be supplied based on the shadow's own configuration. if module.module_type == 'shadow': if datum['module'].unique_id == module.source_module_id: # We're looking at the datum that corresponds to the original module, # so use that module for details detail_module = module else: # Check for case list parent child selection. If both shadow and source use parent case # selection, datums_meta will contain a datum for the parent case, based on the SOURCE's # parent select, and when we see that datum, we need to use the SHADOW's parent select # to supply the details. shadow_active = hasattr(module, 'parent_select') and module.parent_select.active source_active = hasattr(datum_module, 'parent_select') and datum_module.parent_select.active if shadow_active and source_active: if datum['module'].unique_id == datum_module.parent_select.module_id: detail_module = self.app.get_module_by_unique_id(module.parent_select.module_id) detail_persistent = self.get_detail_persistent_attr(datum['module'], detail_module, "case_short") detail_inline = self.get_detail_inline_attr(datum['module'], detail_module, "case_short") fixture_select_filter = '' if datum['module'].fixture_select.active: datums.append(FormDatumMeta( datum=SessionDatum( id=id_strings.fixture_session_var(datum['module']), nodeset=ItemListFixtureXpath(datum['module'].fixture_select.fixture_type).instance(), value=datum['module'].fixture_select.variable_column, detail_select=id_strings.fixture_detail(detail_module) ), case_type=None, requires_selection=True, action='fixture_select' )) filter_xpath_template = datum['module'].fixture_select.xpath fixture_value = session_var(id_strings.fixture_session_var(datum['module'])) fixture_select_filter = "[{}]".format( filter_xpath_template.replace('$fixture_value', fixture_value) ) filter_xpath = EntriesHelper.get_filter_xpath(detail_module) if use_filter else '' datums.append(FormDatumMeta( datum=SessionDatum( id=datum['session_var'], nodeset=(EntriesHelper.get_nodeset_xpath(datum['case_type'], filter_xpath=filter_xpath) + parent_filter + fixture_select_filter), value="./@case_id", detail_select=self.details_helper.get_detail_id_safe(detail_module, 'case_short'), detail_confirm=( self.details_helper.get_detail_id_safe(detail_module, 'case_long') if datum['index'] == 0 and not detail_inline else None ), detail_persistent=detail_persistent, detail_inline=detail_inline, autoselect=datum['module'].auto_select_case, ), case_type=datum['case_type'], requires_selection=True, action='update_case' )) return datums