def _get_custom_xml_detail(self, module, detail, detail_type): d = load_xmlobject_from_string(detail.custom_xml, xmlclass=Detail) expected = id_strings.detail(module, detail_type) if not id_strings.is_custom_app_string(d.id) and d.id != expected: raise SuiteValidationError( "Menu {}, \"{}\", uses custom case list xml. The " "specified detail ID is '{}', expected '{}'".format( module.id, module.default_name(), d.id, expected)) return d
def get_app_ui_translations(request, domain): params = json_request(request.GET) lang = params.get("lang", "en") key = params.get("key", None) one = params.get("one", False) translations = Translation.get_translations(lang, key, one) if isinstance(translations, dict): translations = { k: v for k, v in translations.items() if not id_strings.is_custom_app_string(k) and "=" not in k } return json_response(translations)
def get_app_ui_translations(request, domain): params = json_request(request.GET) lang = params.get('lang', 'en') key = params.get('key', None) one = params.get('one', False) translations = Translation.get_translations(lang, key, one) if isinstance(translations, dict): translations = {k: v for k, v in translations.items() if not id_strings.is_custom_app_string(k) and '=' not in k} return json_response(translations)
def get_section_elements(self): def include_sort(detail_type, detail): return detail_type.endswith( 'short') or detail.sort_nodeset_columns_for_detail() r = [] if not self.app.use_custom_suite: for module in self.modules: for detail_type, detail, enabled in module.get_details(): if enabled: if detail.custom_xml: d = load_xmlobject_from_string(detail.custom_xml, xmlclass=Detail) expected = id_strings.detail(module, detail_type) if not id_strings.is_custom_app_string( d.id) and d.id != expected: raise SuiteValidationError( "Menu {}, \"{}\", uses custom case list xml. The " "specified detail ID is '{}', expected '{}'" .format(module.id, module.default_name(), d.id, expected)) r.append(d) else: detail_column_infos = get_detail_column_infos( detail_type, detail, include_sort=include_sort(detail_type, detail), ) # list of DetailColumnInfo named tuples if detail_column_infos: if detail.use_case_tiles: helper = CaseTileHelper( self.app, module, detail, detail_type, self.build_profile_id) r.append(helper.build_case_tile_detail()) else: print_template_path = None if detail.print_template: print_template_path = detail.print_template[ 'path'] locale_id = id_strings.detail_title_locale( detail_type) title = Text(locale_id=locale_id ) if locale_id else Text() d = self.build_detail( module, detail_type, detail, detail_column_infos, tabs=list(detail.get_tabs()), id=id_strings.detail( module, detail_type), title=title, print_template=print_template_path, ) if d: r.append(d) # add the persist case context if needed and if # case tiles are present and have their own persistent block if (detail.persist_case_context and not (detail.use_case_tiles and detail.persist_tile_on_forms)): d = self._get_persistent_case_context_detail( module, detail.persistent_case_context_xml) r.append(d) if module.fixture_select.active: d = self._get_fixture_detail(module) r.append(d) return r