示例#1
0
    def _collect_select_multiples(cls, dd, language=None):
        select_multiples = []
        select_multiple_elements = [
            e for e in dd.get_survey_elements_with_choices()
            if e.bind.get('type') == 'select'
        ]
        for e in select_multiple_elements:
            xpath = e.get_abbreviated_xpath()
            choices = [(c.get_abbreviated_xpath(), c.name,
                        get_choice_label(c.label, dd, language))
                       for c in e.children]
            if not choices and e.choice_filter and e.itemset:
                itemset = dd.survey.to_json_dict()['choices'].get(e.itemset)
                choices = [(u'/'.join([xpath, i.get('name')]), i.get('name'),
                            get_choice_label(i.get('label'), dd, language))
                           for i in itemset] if itemset else choices
            select_multiples.append((xpath, choices))

        return dict(select_multiples)
示例#2
0
    def _collect_select_multiples(cls, dd, language=None):
        select_multiples = []
        select_multiple_elements = [
            e for e in dd.get_survey_elements_with_choices()
            if e.bind.get('type') == 'select'
        ]
        for e in select_multiple_elements:
            xpath = e.get_abbreviated_xpath()
            choices = [(c.get_abbreviated_xpath(), c.name,
                        get_choice_label(c.label, dd, language))
                       for c in e.children]
            if not choices and e.choice_filter and e.itemset:
                itemset = dd.survey.to_json_dict()['choices'].get(e.itemset)
                choices = [(u'/'.join([xpath, i.get('name')]), i.get('name'),
                            get_choice_label(i.get('label'), dd, language))
                           for i in itemset] if itemset else choices
            select_multiples.append((xpath, choices))

        return dict(select_multiples)