Skip to content

Commit

Permalink
Merge 1d2c5e7 into 530288d
Browse files Browse the repository at this point in the history
  • Loading branch information
rpaw053 committed Oct 17, 2019
2 parents 530288d + 1d2c5e7 commit 4ae48fe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions orcid_hub/__init__.py
Expand Up @@ -135,6 +135,7 @@ def default(self, o):
return super().default(o)


app.config["JSON_AS_ASCII"] = False
app.json_encoder = JSONEncoder


Expand Down
2 changes: 1 addition & 1 deletion orcid_hub/utils.py
Expand Up @@ -2517,7 +2517,7 @@ def dump_yaml(data):
"""Dump the objects into YAML representation."""
yaml.add_representer(datetime, SafeRepresenterWithISODate.represent_datetime, Dumper=Dumper)
yaml.add_representer(defaultdict, SafeRepresenter.represent_dict)
return yaml.dump(data)
return yaml.dump(data, allow_unicode=True)


def enqueue_user_records(user):
Expand Down
11 changes: 8 additions & 3 deletions orcid_hub/views.py
Expand Up @@ -1128,8 +1128,13 @@ def _export_tablib(self, export_type, return_url):

try:
try:
ds.yaml = yaml.safe_dump(json.loads(ds.json.replace("]\\", "]").replace("\\n", " ")))
response_data = ds.export(format=export_type)
if export_type == 'json':
response_data = json.dumps(json.loads(ds.json), ensure_ascii=False)
elif export_type == 'yaml':
response_data = yaml.safe_dump(json.loads(ds.json.replace("]\\", "]").replace("\\n", " ")),
allow_unicode=True)
else:
response_data = ds.export(format=export_type)
except AttributeError:
response_data = getattr(ds, export_type)
except (AttributeError, tablib.UnsupportedFormat):
Expand Down Expand Up @@ -1618,7 +1623,7 @@ class AffiliationRecordAdmin(CompositeRecordModelView):
"start_date",
"end_date",
"city",
"state",
"region",
"country",
"disambiguated_id",
"disambiguation_source",
Expand Down

0 comments on commit 4ae48fe

Please sign in to comment.