Skip to content
This repository has been archived by the owner on Feb 4, 2020. It is now read-only.

Commit

Permalink
use @six.python_2_unicode_compatible decorator to make str(Record) wo…
Browse files Browse the repository at this point in the history
…rk correctly in Python 2; use six.text_type when building list of textual strings. Fixes issue #74.
  • Loading branch information
Wooble committed Aug 6, 2015
1 parent 20a5641 commit 8e14f8c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pymarc/record.py
Expand Up @@ -28,6 +28,7 @@

isbn_regex = re.compile(r'([0-9\-xX]+)')

@six.python_2_unicode_compatible
class Record(Iterator):
"""
A class for representing a MARC record. Each Record object is made up of
Expand Down Expand Up @@ -81,7 +82,7 @@ def __str__(self):
"""
# join is significantly faster than concatenation
text_list = ['=LDR %s' % self.leader]
text_list.extend([str(field) for field in self.fields])
text_list.extend([six.text_type(field) for field in self.fields])
text = '\n'.join(text_list) + '\n'
return text

Expand Down

0 comments on commit 8e14f8c

Please sign in to comment.