← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~mzibricky/openlp/bug-1046599 into lp:openlp

 

matysek has proposed merging lp:~mzibricky/openlp/bug-1046599 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1046599 in OpenLP: "set Data Location fails with non-english set Data Location fails with non-english characters"
  https://bugs.launchpad.net/openlp/+bug/1046599

For more details, see:
https://code.launchpad.net/~mzibricky/openlp/bug-1046599/+merge/123039

This fixes the related bug when changing data location to a path with non-english characters.

It was caused by incorrect formatting of string submitted to translate() function. Code like

translate('OpenLP.AdvancedTab', 'data directory to:\n\n%s\n\n' % new_data_path)

- works with english filenames
- this string is modified with a non-constant value before passing to translation

workaround is

translate('OpenLP.AdvancedTab', 'data directory to:\n\n%s\n\n').replace('%s', new_data_path)

- returned string is QString() thus python substitution with '%s' does not work

Conclusion:
- we should review the UI code and do similar fixes where string is modified before passing to translate()
- I'm pretty sure fixing other places will solve more reported bugs and probably prevent new bugs caused by this issue.
-- 
https://code.launchpad.net/~mzibricky/openlp/bug-1046599/+merge/123039
Your team OpenLP Core is requested to review the proposed merge of lp:~mzibricky/openlp/bug-1046599 into lp:openlp.
=== modified file 'openlp/core/ui/advancedtab.py'
--- openlp/core/ui/advancedtab.py	2012-07-15 11:59:55 +0000
+++ openlp/core/ui/advancedtab.py	2012-09-06 09:52:19 +0000
@@ -686,7 +686,7 @@
                 'Are you sure you want to change the location of the OpenLP '
                 'data directory to:\n\n%s\n\n'
                 'The data directory will be changed when OpenLP is closed.'
-                % new_data_path),
+                ).replace('%s', new_data_path),
             QtGui.QMessageBox.StandardButtons(
             QtGui.QMessageBox.Yes |
             QtGui.QMessageBox.No),

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2012-08-04 17:09:12 +0000
+++ openlp/core/ui/mainwindow.py	2012-09-06 09:52:19 +0000
@@ -1517,7 +1517,7 @@
                     translate('OpenLP.MainWindow',
                     'Copying OpenLP data to new data directory location - %s '
                     '- Please wait for copy to finish'
-                    % self.newDataPath))
+                    ).replace('%s', self.newDataPath))
                 dir_util.copy_tree(old_data_path, self.newDataPath)
                 log.info(u'Copy sucessful')
             except (IOError, os.error, DistutilsFileError),  why:
@@ -1527,7 +1527,7 @@
                     translate('OpenLP.MainWindow', 'New Data Directory Error'),
                     translate('OpenLP.MainWindow',
                     'OpenLP Data directory copy failed\n\n%s'
-                    % unicode(why)),
+                    ).replace('%s', unicode(why)),
                 QtGui.QMessageBox.StandardButtons(
                 QtGui.QMessageBox.Ok))
                 return False


Follow ups