Differentiated error message for zero sized service.

This commit is contained in:
Mattias Põldaru 2011-03-16 09:55:08 +02:00
parent 18f9632dda
commit b502ad549c

View File

@ -557,7 +557,15 @@ class ServiceManager(QtGui.QWidget):
except (IOError, NameError): except (IOError, NameError):
log.exception(u'Problem loading service file %s' % fileName) log.exception(u'Problem loading service file %s' % fileName)
except zipfile.BadZipfile: except zipfile.BadZipfile:
log.exception(u'Service file is corrupt: %s' % fileName) if os.path.getsize(fileName) == 0:
log.exception(u'Service file is zero sized: %s' % fileName)
QtGui.QMessageBox.information(self,
translate('OpenLP.ServiceManager', 'File Is Empty'),
translate('OpenLP.ServiceManager', 'This service file is '
'zero size and does not contain any data.'))
else:
log.exception(u'Service file is cannot be extracted as zip: '
u'%s' % fileName)
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
translate('OpenLP.ServiceManager', 'File Is Corrupt'), translate('OpenLP.ServiceManager', 'File Is Corrupt'),
translate('OpenLP.ServiceManager', 'This service file is ' translate('OpenLP.ServiceManager', 'This service file is '