summaryrefslogtreecommitdiff
path: root/alot/commands
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-01-16 10:49:06 +0100
committerAnton Khirnov <anton@khirnov.net>2021-01-16 10:49:06 +0100
commit3fb4d66b584beb3fc91fc22708cd83b125b567d9 (patch)
tree93c502868e778dd8c36fb06b06f09a831622af55 /alot/commands
parentb1d0512f0e20b709858151818ddc508fd00dfe4a (diff)
helper: get rid of decode_string()
It just adds unnecessary type confusion. In most places where it is used, the types are always str, so it does nothing. In the few others, the encoding/decoding is better handled explicitly.
Diffstat (limited to 'alot/commands')
-rw-r--r--alot/commands/__init__.py3
-rw-r--r--alot/commands/envelope.py5
2 files changed, 3 insertions, 5 deletions
diff --git a/alot/commands/__init__.py b/alot/commands/__init__.py
index 1e16b4d4..61ff7f21 100644
--- a/alot/commands/__init__.py
+++ b/alot/commands/__init__.py
@@ -8,7 +8,7 @@ import os
import re
from ..settings.const import settings
-from ..helper import split_commandstring, string_decode
+from ..helper import split_commandstring
class Command:
@@ -167,7 +167,6 @@ def commandfactory(cmdline, mode='global'):
args = split_commandstring(cmdline)
except ValueError as e:
raise CommandParseError(str(e))
- args = [string_decode(x, 'utf-8') for x in args]
logging.debug('ARGS: %s', args)
cmdname = args[0]
args = args[1:]
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py
index 914829eb..1f806581 100644
--- a/alot/commands/envelope.py
+++ b/alot/commands/envelope.py
@@ -23,7 +23,6 @@ from .. import crypto
from ..account import SendingMailFailed, StoreMailError
from ..db.errors import DatabaseError
from ..errors import GPGProblem
-from ..helper import string_decode
from ..settings.const import settings
from ..settings.errors import NoMatchingAccount
from ..utils import argparse as cargparse
@@ -357,8 +356,8 @@ class EditCommand(Command):
# get input
# tempfile will be removed on buffer cleanup
enc = settings.get('editor_writes_encoding')
- with open(self.envelope.tmpfile.name) as f:
- template = string_decode(f.read(), enc)
+ with open(self.envelope.tmpfile.name, 'rb') as f:
+ template = f.read().decode(enc)
# call post-edit translate hook
translate = settings.get_hook('post_edit_translate')