Skip to content

Commit

Permalink
fix(logic): ordered dicts;
Browse files Browse the repository at this point in the history
- Changed `OrderedDict` to `{}`.
  • Loading branch information
JVickery-TBS committed Oct 1, 2024
1 parent 055a648 commit 4d464b4
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions ckanext/recombinant/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,24 +327,24 @@ def _schema_json(dataset_type, published_resource=False):
except RecombinantException:
return abort(404, _('Recombinant dataset_type not found'))

schema = OrderedDict()
schema = {}
schema['dataset_type'] = geno['dataset_type']
schema['title'] = OrderedDict()
schema['notes'] = OrderedDict()
schema['title'] = {}
schema['notes'] = {}

for lang in config['ckan.locales_offered'].split():
with force_locale(lang):
schema['title'][lang] = _(geno['title'])
schema['notes'][lang] = _(geno['notes'])

if 'front_matter' in geno:
schema['front_matter'] = OrderedDict()
schema['front_matter'] = {}
for lang in sorted(geno['front_matter']):
schema['front_matter'][lang] = geno['front_matter'][lang]

schema['resources'] = []
for chromo in geno['resources']:
resource = OrderedDict()
resource = {}
schema['resources'].append(resource)
choice_fields = recombinant_choice_fields(
chromo['resource_name'],
Expand All @@ -353,7 +353,7 @@ def _schema_json(dataset_type, published_resource=False):
pkeys = aslist(chromo['datastore_primary_key'])

resource['resource_name'] = chromo['resource_name']
resource['title'] = OrderedDict()
resource['title'] = {}
for lang in config['ckan.locales_offered'].split():
with force_locale(lang):
resource['title'][lang] = _(chromo['title'])
Expand All @@ -367,10 +367,10 @@ def _schema_json(dataset_type, published_resource=False):
continue
if not published_resource and field.get('published_resource_computed_field', False):
continue
fld = OrderedDict()
fld = {}
resource['fields'].append(fld)
fld['id'] = field['datastore_id']
fld['obligation'] = OrderedDict()
fld['obligation'] = {}
for lang in config['ckan.locales_offered'].split():
with force_locale(lang):
if fld['id'] in pkeys:
Expand All @@ -386,22 +386,22 @@ def _schema_json(dataset_type, published_resource=False):
if isinstance(field[k], dict):
fld[k] = field[k]
continue
fld[k] = OrderedDict()
fld[k] = {}
for lang in config['ckan.locales_offered'].split():
with force_locale(lang):
fld[k][lang] = _(field[k])

fld['datastore_type'] = field['datastore_type']

if fld['id'] in choice_fields:
choices = OrderedDict()
choices = {}
fld['choices'] = choices
for ck, cv in choice_fields[fld['id']]:
choices[ck] = cv

if not published_resource and 'examples' in chromo:
ex_record = chromo['examples']['record']
example = OrderedDict()
example = {}
for field in chromo['fields']:
if field['datastore_id'] in ex_record:
example[field['datastore_id']] = ex_record[
Expand Down

0 comments on commit 4d464b4

Please sign in to comment.