def _show(self): schemas = [ ("Dataset", scheming_dataset_schemas()), ("Group", scheming_group_schemas()), ("Organization", scheming_organization_schemas()), ] for n, s in schemas: print n, "schemas:" if s is None: print " plugin not loaded or schema not specified\n" continue if not s: print " no schemas" for typ in sorted(s): print " * " + json.dumps(typ) field_names = ('dataset_fields', 'fields', 'resource_fields') for field_name in field_names: if s[typ].get(field_name): if field_name == 'resource_fields': print " * " + json.dumps("resource") for field in s[typ][field_name]: print " - " + json.dumps(field['field_name']) print
def _show(self): schemas = [ ("Dataset", scheming_dataset_schemas()), ("Group", scheming_group_schemas()), ("Organization", scheming_organization_schemas()), ] for n, s in schemas: print n, "schemas:" if s is None: print " plugin not loaded or schema not specified\n" continue if not s: print " no schemas" for typ in sorted(s): print " * " + json.dumps(typ) field_names = ('dataset_fields', 'fields', 'resource_fields') for field_name in field_names: if s[typ].get(field_name): if field_name == 'resource_fields': print " * " + json.dumps("resource") for field in s[typ][field_name]: print " - " + json.dumps(field['field_name']), print scheming_language_text(field.get('label')) print
def ccca_sort_groups_dropdown(pkg_groups): #Sort Groups accroding to type # Anja, 22.6.18: For the dropdown menu to add a package to a group #group_type_list: schema = hs.scheming_group_schemas() group_info = schema['group'] field_list = group_info['fields'] for x in field_list: if x['field_name'] == 'type_of_group': group_type_list = x['choices'] group_list = logic.get_action('group_list')({}, { 'all_fields': True, 'include_extras': True }) #reverse Order because of insertion method below rev_groups = sorted(pkg_groups, key=lambda tup: tup[1], reverse=True) sorted_groups = [] for x in rev_groups: group = _get_group(x[0], group_list) group_type = '' group_type_label = '' if 'type_of_group' in group: group_type = group['type_of_group'] if group_type: group_type_label = _get_group_type_label(group_type, group_type_list) else: group_type = 'other' group_type_label = 'Other' if not sorted_groups or _get_group_index_dropdown( group_type_label, sorted_groups) < 0: f = [] f.append('-') # Empty id for group types f.append(group_type_label) f.append(False) x.append(True) sorted_groups.append(f) sorted_groups.append(x) else: index = _get_group_index_dropdown(group_type_label, sorted_groups) if index >= 0: x.append(True) sorted_groups.insert(index + 1, x) for g in sorted_groups: if not g[2]: g[1] = g[1] + ': ' return sorted_groups
def ccca_sort_groups_list(pkg_groups): # sorting for the group_list # Anja, 22.6.18: For the overview of groups a package belongs to #group_type_list: schema = hs.scheming_group_schemas() group_info = schema['group'] field_list = group_info['fields'] for x in field_list: if x['field_name'] == 'type_of_group': group_type_list = x['choices'] #reverse Order because of insertion method below group_list = logic.get_action('group_list')({}, { 'all_fields': True, 'include_extras': True }) rev_groups = sorted(pkg_groups, key=lambda k: k['name'], reverse=True) sorted_groups = [] for x in rev_groups: group = _get_group(x['id'], group_list) group_type = '' group_type_label = '' if 'type_of_group' in group: group_type = group['type_of_group'] if group_type: group_type_label = _get_group_type_label(group_type, group_type_list) else: group_type = 'other' group_type_label = 'Other' if not sorted_groups or _get_group_index_list(group_type, sorted_groups) < 0: f = {} f['description'] = group['description'] f['name'] = group_type f['display_name'] = group_type_label + ': ' f['title'] = group_type_label + ': ' f['is_type'] = True sorted_groups.append(f) x['is_type'] = False sorted_groups.append(x) else: index = _get_group_index_list(group_type, sorted_groups) if index >= 0: x['is_type'] = False sorted_groups.insert(index + 1, x) return sorted_groups
def ccca_sort_groups_dropdown(pkg_groups): #Sort Groups accroding to type # Anja, 22.6.18: For the dropdown menu to add a package to a group #group_type_list: schema = hs.scheming_group_schemas() group_info = schema['group'] field_list = group_info['fields'] for x in field_list: if x['field_name'] == 'type_of_group': group_type_list = x['choices'] group_list = logic.get_action('group_list')({}, {'all_fields':True, 'include_extras':True}) #reverse Order because of insertion method below rev_groups = sorted(pkg_groups, key=lambda tup: tup[1], reverse=True) sorted_groups = [] for x in rev_groups: group = _get_group(x[0], group_list) group_type = '' group_type_label = '' if 'type_of_group' in group: group_type = group['type_of_group'] if group_type: group_type_label = _get_group_type_label(group_type, group_type_list) else: group_type = 'other' group_type_label = 'Other' if not sorted_groups or _get_group_index_dropdown(group_type_label,sorted_groups) <0: f = [] f.append('-') # Empty id for group types f.append( group_type_label) f.append(False) x.append(True) sorted_groups.append(f) sorted_groups.append(x) else: index=_get_group_index_dropdown(group_type_label,sorted_groups) if index >= 0: x.append(True) sorted_groups.insert(index+1, x) for g in sorted_groups: if not g[2]: g[1] = g[1] + ': ' return sorted_groups
def _show(self): for n, s in ( ("Dataset", scheming_dataset_schemas()), ("Group", scheming_group_schemas()), ("Organization", scheming_organization_schemas()), ): print n, "schemas:" if s is None: print " plugin not loaded\n" continue if not s: print " no schemas" for typ in sorted(s): print " * " + json.dumps(typ) for field in s[typ]['fields']: print " - " + json.dumps(field['field_name']) print
def ccca_sort_groups_list(pkg_groups): # sorting for the group_list # Anja, 22.6.18: For the overview of groups a package belongs to #group_type_list: schema = hs.scheming_group_schemas() group_info = schema['group'] field_list = group_info['fields'] for x in field_list: if x['field_name'] == 'type_of_group': group_type_list = x['choices'] #reverse Order because of insertion method below group_list = logic.get_action('group_list')({}, {'all_fields':True, 'include_extras':True}) rev_groups = sorted(pkg_groups, key=lambda k: k['name'], reverse=True) sorted_groups = [] for x in rev_groups: group = _get_group(x['id'], group_list) group_type = '' group_type_label = '' if 'type_of_group' in group: group_type = group['type_of_group'] if group_type: group_type_label = _get_group_type_label(group_type, group_type_list) else: group_type = 'other' group_type_label = 'Other' if not sorted_groups or _get_group_index_list(group_type,sorted_groups) <0: f = {} f['description'] = group['description'] f['name'] = group_type f['display_name'] = group_type_label + ': ' f['title'] = group_type_label + ': ' f['is_type'] = True sorted_groups.append(f) x['is_type'] = False sorted_groups.append(x) else: index=_get_group_index_list(group_type,sorted_groups) if index >= 0: x['is_type'] = False sorted_groups.insert(index+1, x) return sorted_groups
def scheming_group_schema_list(context, data_dict): """ Return a list of group types customized with the scheming extension """ return list(scheming_group_schemas())
def scheming_group_schema_list(context, data_dict): ''' Return a list of group types customized with the scheming extension ''' return list(scheming_group_schemas())