Skip to content

Commit

Permalink
builders: fix unicode issues in LiteratureBuilder
Browse files Browse the repository at this point in the history
Signed-off-by: Micha Moskovic <michamos@gmail.com>
  • Loading branch information
michamos committed Jul 30, 2019
1 parent 415271c commit 7b2d887
Show file tree
Hide file tree
Showing 31 changed files with 10,441 additions and 4 deletions.
9 changes: 5 additions & 4 deletions inspire_schemas/builders/literature.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"""Literature builder class and related code."""

from __future__ import absolute_import, division, print_function
from six import string_types
from six import python_2_unicode_compatible, string_types, text_type

import warnings

Expand Down Expand Up @@ -84,6 +84,7 @@ def key_already_there(element, elements):
return False


@python_2_unicode_compatible
class LiteratureBuilder(object):
"""Literature record builder."""

Expand Down Expand Up @@ -125,11 +126,11 @@ def _append_to(self, field, element):

def __str__(self):
"""Print the current record."""
return str(self.record)
return text_type(self.record)

def __repr__(self):
"""Printable representation of the builder."""
return 'LiteratureBuilder(source={!r}, record={})'.format(
return u'LiteratureBuilder(source={!r}, record={})'.format(
self.source,
self.record
)
Expand Down Expand Up @@ -463,7 +464,7 @@ def add_publication_info(
if journal_title and all(
not field for field in (cnum, artid, journal_issue,
journal_volume, page_start, page_end)):
self.add_public_note('Submitted to {}'.format(journal_title))
self.add_public_note(u'Submitted to {}'.format(journal_title))
return

publication_item = {}
Expand Down
1,684 changes: 1,684 additions & 0 deletions inspire_schemas/resolved_records/authors.json

Large diffs are not rendered by default.

Loading

0 comments on commit 7b2d887

Please sign in to comment.