openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #17407
[Merge] lp:~phill-ridout/openlp/bug1063421 into lp:openlp
phill has proposed merging lp:~phill-ridout/openlp/bug1063421 into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #1063421 in OpenLP: "Error when attempting to import a Sunday Plus song file."
https://bugs.launchpad.net/openlp/+bug/1063421
For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/bug1063421/+merge/128822
Fixed bug1063421
It was iterating over a list, however items were being poped out causing an index error
--
https://code.launchpad.net/~phill-ridout/openlp/bug1063421/+merge/128822
Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/bug1063421 into lp:openlp.
=== modified file 'openlp/plugins/songs/lib/sundayplusimport.py'
--- openlp/plugins/songs/lib/sundayplusimport.py 2012-07-04 20:08:04 +0000
+++ openlp/plugins/songs/lib/sundayplusimport.py 2012-10-09 21:03:22 +0000
@@ -154,18 +154,20 @@
# 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
Follow ups