Skip to content

Commit

Permalink
Handling empty elements in record.DCRecord get_element
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmiguez committed Jul 8, 2020
1 parent eb93bce commit 21aeb17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pymods/record.py
Expand Up @@ -780,8 +780,8 @@ def get_element(self, elem, delimiter=None):
"""
if self.find('{0}'.format(elem)) is not None:
if delimiter is None:
return [item.text for item in self.findall('{0}'.format(elem))]
return [item.text for item in self.findall('{0}'.format(elem)) if item.text]
else:
return [split_text.strip()
for item in self.findall('{0}'.format(elem))
for item in self.findall('{0}'.format(elem)) if item.text
for split_text in item.text.split(delimiter)]
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -9,7 +9,7 @@

setup(
name="pymods",
version="2.0.8",
version="2.0.9",
packages=find_packages(exclude=['tests*']),
install_requires=['lxml >= 2.3'],
author="Matthew Miguez",
Expand Down

0 comments on commit 21aeb17

Please sign in to comment.