Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

format_field() in field.py #9

Merged
merged 1 commit into from

2 participants

@lawlesst

Hi Ed,

I made a minor change to the format_field method in field.py that I thought I would share in case it is helpful to others.

format_filed() will now ignore subfield 6 when called. This eliminates getting formatted field strings that contain the pointers to 880 fields with foreign scripts. It was returning stings like "880-01 Fu, Jin, 1956-" or "880-02 Xin Zhongguo xi ju shi".

I added a subfield 6 in test/field.py to verify that it's doing what I intended.

Thanks for your work on the library. I use it often.

Ted Lawless

@edsu edsu merged commit a4ef9b2 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 5, 2010
  1. In field.py format_field() will now ignore subfield 6, which is a poi…

    Ted Lawless authored
    …nter to linked 880 fields.
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 2 deletions.
  1. +2 −0  pymarc/field.py
  2. +4 −2 test/field.py
View
2  pymarc/field.py
@@ -179,6 +179,8 @@ def format_field(self):
return self.data
fielddata = ''
for subfield in self:
+ if subfield[0] == '6':
+ continue
if not self.is_subject_field():
fielddata += ' %s' % subfield[1]
else:
View
6 test/field.py
@@ -97,9 +97,11 @@ def test_is_subject_field(self):
self.assertEqual(self.field.is_subject_field(), False)
def test_format_field(self):
- self.assertEqual(self.subjectfield.format_field(),
+ self.subjectfield.add_subfield('6', '880-4')
+ self.assertEqual(self.subjectfield.format_field(),
'Python (Computer program language) -- Poetry.')
- self.assertEqual(self.field.format_field(),
+ self.field.add_subfield('6', '880-1')
+ self.assertEqual(self.field.format_field(),
'Huckleberry Finn: An American Odyssey')
def test_tag_normalize(self):
Something went wrong with that request. Please try again.