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
1 changed files with 8 additions and 6 deletions

View File

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