Skip to content

Commit

Permalink
adding edi fields if broken
Browse files Browse the repository at this point in the history
  • Loading branch information
matijakolaric committed Dec 20, 2019
1 parent 5a3d0bb commit fec5983
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion music_metadata/edi/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __set_name__(self, owner, name):

def __get__(self, instance, owner=None):
if instance:
return instance.__dict__[self._name]
return instance.__dict__.get(self._name)
return self

def __set__(self, instance, value):
Expand Down
7 changes: 5 additions & 2 deletions music_metadata/edi/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,11 @@ def to_dict(self, verbosity=1):
for label, field in self.get_fields().items():

# first three fields can be skipped
if label in ['record_type', 'transaction_sequence_number',
'record_sequence_number']:
if label in [
'record_type',
'transaction_sequence_number',
'record_sequence_number'
] and label not in self.errors.keys():
continue

# constant fields can be skipper as well
Expand Down

0 comments on commit fec5983

Please sign in to comment.