summaryrefslogtreecommitdiff
path: root/alot/db
diff options
context:
space:
mode:
authorLucas Hoffmann <lucc@posteo.de>2019-11-04 08:00:10 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2019-11-06 10:54:00 +0000
commit414ca6c4b57752d139598e95e06009c55ff4543c (patch)
treea77d60aaf05f2c75224df95f7481f7328e414e7a /alot/db
parentbbb96525c08f0c6ee9fc93e0dd0ccb3abfd1dca8 (diff)
Remove unicode literals syntax from python2
Diffstat (limited to 'alot/db')
-rw-r--r--alot/db/envelope.py4
-rw-r--r--alot/db/utils.py18
2 files changed, 11 insertions, 11 deletions
diff --git a/alot/db/envelope.py b/alot/db/envelope.py
index 35aa0fee..291ee849 100644
--- a/alot/db/envelope.py
+++ b/alot/db/envelope.py
@@ -78,7 +78,7 @@ class Envelope:
self.parse_template(template)
logging.debug('PARSED TEMPLATE: %s', template)
logging.debug('BODY: %s', self.body)
- self.body = bodytext or u''
+ self.body = bodytext or ''
# TODO: if this was as collections.defaultdict a number of methods
# could be simplified.
self.headers = headers or {}
@@ -100,7 +100,7 @@ class Envelope:
def __setitem__(self, name, val):
"""setter for header values. This allows adding header like so:
- envelope['Subject'] = u'sm\xf8rebr\xf8d'
+ envelope['Subject'] = 'sm\xf8rebr\xf8d'
"""
if name not in self.headers:
self.headers[name] = []
diff --git a/alot/db/utils.py b/alot/db/utils.py
index 194e726a..97406e3a 100644
--- a/alot/db/utils.py
+++ b/alot/db/utils.py
@@ -50,7 +50,7 @@ def add_signature_headers(mail, sigs, error_msg):
assert error_msg is None or isinstance(error_msg, str)
if not sigs:
- error_msg = error_msg or u'no signature found'
+ error_msg = error_msg or 'no signature found'
elif not error_msg:
try:
key = crypto.get_key(sigs[0].fpr)
@@ -112,19 +112,19 @@ def _handle_signatures(original, message, params):
"""
malformed = None
if len(message.get_payload()) != 2:
- malformed = u'expected exactly two messages, got {0}'.format(
+ malformed = 'expected exactly two messages, got {0}'.format(
len(message.get_payload()))
else:
ct = message.get_payload(1).get_content_type()
if ct != _APP_PGP_SIG:
- malformed = u'expected Content-Type: {0}, got: {1}'.format(
+ malformed = 'expected Content-Type: {0}, got: {1}'.format(
_APP_PGP_SIG, ct)
# TODO: RFC 3156 says the alg has to be lower case, but I've seen a message
# with 'PGP-'. maybe we should be more permissive here, or maybe not, this
# is crypto stuff...
if not params.get('micalg', 'nothing').startswith('pgp-'):
- malformed = u'expected micalg=pgp-..., got: {0}'.format(
+ malformed = 'expected micalg=pgp-..., got: {0}'.format(
params.get('micalg', 'nothing'))
sigs = []
@@ -161,13 +161,13 @@ def _handle_encrypted(original, message, session_keys=None):
ct = message.get_payload(0).get_content_type()
if ct != _APP_PGP_ENC:
- malformed = u'expected Content-Type: {0}, got: {1}'.format(
+ malformed = 'expected Content-Type: {0}, got: {1}'.format(
_APP_PGP_ENC, ct)
want = 'application/octet-stream'
ct = message.get_payload(1).get_content_type()
if ct != want:
- malformed = u'expected Content-Type: {0}, got: {1}'.format(want, ct)
+ malformed = 'expected Content-Type: {0}, got: {1}'.format(want, ct)
if not malformed:
# This should be safe because PGP uses US-ASCII characters only
@@ -209,7 +209,7 @@ def _handle_encrypted(original, message, session_keys=None):
add_signature_headers(original, sigs, '')
if malformed:
- msg = u'Malformed OpenPGP message: {0}'.format(malformed)
+ msg = 'Malformed OpenPGP message: {0}'.format(malformed)
content = email.message_from_string(msg,
_class=email.message.EmailMessage,
policy=email.policy.SMTP)
@@ -317,11 +317,11 @@ def extract_headers(mail, headers=None):
:param headers: headers to extract
:type headers: list of str
"""
- headertext = u''
+ headertext = ''
if headers is None:
headers = mail.keys()
for key in headers:
- value = u''
+ value = ''
if key in mail:
value = decode_header(mail.get(key, ''))
headertext += '%s: %s\n' % (key, value)