Commit d606d862 authored by Jacek Sowiński's avatar Jacek Sowiński

Fix unicode in error messages for cmds operating on multiple todo items.

Otherwise it wil fail when <NUMBER> contains some unicode diacritics.
parent de1a805d
...@@ -18,6 +18,8 @@ import os ...@@ -18,6 +18,8 @@ import os
from subprocess import call, check_call, CalledProcessError from subprocess import call, check_call, CalledProcessError
import tempfile import tempfile
from six import u
from topydo.commands.ListCommand import ListCommand from topydo.commands.ListCommand import ListCommand
from topydo.lib.MultiCommand import MultiCommand from topydo.lib.MultiCommand import MultiCommand
from topydo.lib.Config import config from topydo.lib.Config import config
...@@ -77,7 +79,7 @@ class EditCommand(MultiCommand, ListCommand): ...@@ -77,7 +79,7 @@ class EditCommand(MultiCommand, ListCommand):
if len(self.invalid_numbers) > 1 or len(self.invalid_numbers) > 0 and len(self.todos) > 0: if len(self.invalid_numbers) > 1 or len(self.invalid_numbers) > 0 and len(self.todos) > 0:
for number in self.invalid_numbers: for number in self.invalid_numbers:
errors.append("Invalid todo number given: {}.".format(number)) errors.append(u("Invalid todo number given: {}.").format(number))
elif len(self.invalid_numbers) == 1 and len(self.todos) == 0: elif len(self.invalid_numbers) == 1 and len(self.todos) == 0:
errors.append("Invalid todo number given.") errors.append("Invalid todo number given.")
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from six import u
from topydo.lib.Command import Command from topydo.lib.Command import Command
from topydo.lib.TodoListBase import InvalidTodoException from topydo.lib.TodoListBase import InvalidTodoException
...@@ -52,7 +54,7 @@ class MultiCommand(Command): ...@@ -52,7 +54,7 @@ class MultiCommand(Command):
if len(self.invalid_numbers) > 1 or len(self.invalid_numbers) > 0 and len(self.todos) > 0: if len(self.invalid_numbers) > 1 or len(self.invalid_numbers) > 0 and len(self.todos) > 0:
for number in self.invalid_numbers: for number in self.invalid_numbers:
errors.append("Invalid todo number given: {}.".format(number)) errors.append(u("Invalid todo number given: {}.").format(number))
elif len(self.invalid_numbers) == 1 and len(self.todos) == 0: elif len(self.invalid_numbers) == 1 and len(self.todos) == 0:
errors.append("Invalid todo number given.") errors.append("Invalid todo number given.")
elif len(self.todos) == 0 and len(self.invalid_numbers) == 0: elif len(self.todos) == 0 and len(self.invalid_numbers) == 0:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment