fixes bug 1063421

I was iterating over a loop as well as poping items out causing an index error
This commit is contained in:
Philip Ridout 2012-10-09 21:59:33 +01:00
parent 2674a21cbd
commit 9956e0b0c6

View File

@ -154,18 +154,20 @@ class SundayPlusImport(SongImport):
# If any line inside any verse contains CCLI or # If any line inside any verse contains CCLI or
# only Public Domain, we treat this as special data: # only Public Domain, we treat this as special data:
# we remove that line and add data to specific field. # we remove that line and add data to specific field.
processed_lines = []
for i in xrange(len(lines)): for i in xrange(len(lines)):
lines[i] = lines[i].strip() line = lines[i].strip()
line = lines[i] if line[:3].lower() == u'ccl':
if line[:4].lower() == u'ccli':
m = re.search(r'[0-9]+', line) m = re.search(r'[0-9]+', line)
if m: if m:
self.ccliNumber = int(m.group(0)) self.ccliNumber = int(m.group(0))
lines.pop(i) continue
elif line.lower() == u'public domain': elif line.lower() == u'public domain':
self.copyright = u'Public Domain' self.copyright = u'Public Domain'
lines.pop(i) continue
self.addVerse('\n'.join(lines).strip(), verse_type) processed_lines.append(line)
self.addVerse('\n'.join(processed_lines).strip(),
verse_type)
if end == -1: if end == -1:
break break
i = end + 1 i = end + 1