openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00373
[Merge] lp:~meths/openlp/trivialfixes into lp:openlp
Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.
Requested reviews:
openlp.org Core (openlp-core)
Fix service loading on Windows
--
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/12121
Your team openlp.org Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2009-09-18 18:20:58 +0000
+++ openlp/core/ui/servicemanager.py 2009-09-19 19:37:01 +0000
@@ -24,6 +24,7 @@
import os
import sys
+import string
import logging
import cPickle
import zipfile
@@ -416,7 +417,7 @@
directory and will only be used for this service.
"""
filename = QtGui.QFileDialog.getOpenFileName(self,
- u'Open Order of Service',self.config.get_last_dir(),
+ u'Open Order of Service', self.config.get_last_dir(),
u'Services (*.oos)')
filename = unicode(filename)
name = filename.split(os.path.sep)
@@ -426,14 +427,17 @@
zip = zipfile.ZipFile(unicode(filename))
filexml = None
themename = None
-
for file in zip.namelist():
- names = file.split(os.path.sep)
+ if os.name == u'nt':
+ winfile = string.replace(file, '/', os.path.sep)
+ names = winfile.split(os.path.sep)
+ else:
+ names = file.split(os.path.sep)
file_to = os.path.join(self.servicePath,
names[len(names) - 1])
- file_data = zip.read(file)
- f = open(file_to, u'w')
- f.write(file_data)
+ f = open(file_to, u'wb')
+ f.write(zip.read(file))
+ f.flush()
f.close()
if file_to.endswith(u'ood'):
p_file = file_to
@@ -449,11 +453,9 @@
try:
os.remove(p_file)
except:
- #if not present do not worry
- pass
+ log.exception(u'Failed to remove ood file')
except:
log.exception(u'Problem loading a service file')
- pass
self.isNew = False
self.serviceName = name[len(name) - 1]
self.parent.OosChanged(True, self.serviceName)
Follow ups