openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #06841
[Merge] lp:~googol-hush/openlp/fixes into lp:openlp
Andreas Preikschat has proposed merging lp:~googol-hush/openlp/fixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #598393 in OpenLP: "After adding a new image to a selected (image) item in the service manager it is not selected anymore"
https://bugs.launchpad.net/openlp/+bug/598393
Bug #730979 in OpenLP: "Song export crashes"
https://bugs.launchpad.net/openlp/+bug/730979
For more details, see:
https://code.launchpad.net/~googol-hush/openlp/fixes/+merge/52880
Hello,
fixed bug #730979
(Note, I actually wanted to add a method to core/lib/__init__ to prevent having things twice. However, the code in plugins/bibles/lib/db needs to deal differently with particular characters.)
--
https://code.launchpad.net/~googol-hush/openlp/fixes/+merge/52880
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/fixes into lp:openlp.
=== modified file 'openlp/plugins/songs/lib/openlyricsexport.py'
--- openlp/plugins/songs/lib/openlyricsexport.py 2011-02-24 05:47:38 +0000
+++ openlp/plugins/songs/lib/openlyricsexport.py 2011-03-10 16:28:20 +0000
@@ -29,10 +29,11 @@
"""
import logging
import os
+import re
from lxml import etree
-from openlp.core.lib import Receiver, translate
+from openlp.core.lib import check_directory_exists, Receiver, translate
from openlp.plugins.songs.lib import OpenLyrics
log = logging.getLogger(__name__)
@@ -50,8 +51,7 @@
self.manager = parent.plugin.manager
self.songs = songs
self.save_path = save_path
- if not os.path.exists(self.save_path):
- os.mkdir(self.save_path)
+ check_directory_exists(self.save_path)
def do_export(self):
"""
@@ -69,6 +69,10 @@
song.title)
xml = openLyrics.song_to_xml(song)
tree = etree.ElementTree(etree.fromstring(xml))
- tree.write(os.path.join(self.save_path, song.title + u'.xml'),
+ filename = u'%s (%s).xml' % (song.title,
+ u', '.join([author.display_name for author in song.authors]))
+ filename = re.sub(
+ r'[/\\?*|<>\[\]":<>+%]+', u'_', filename).strip(u'_')
+ tree.write(os.path.join(self.save_path, filename),
encoding=u'utf-8', xml_declaration=True, pretty_print=True)
return True
Follow ups