From 1fae7839e2facd1fcde2210418815624a02bc666 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Mon, 15 Jul 2019 15:44:38 +0000 Subject: [PATCH] Py2/3 compatibility: Added __future__ import and an explicit encoding scheme, not relying on py3's implicit utf-8 - Legacy-Id: 16447 --- ietf/nomcom/fields.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ietf/nomcom/fields.py b/ietf/nomcom/fields.py index f418bb382..be8c5ba6c 100644 --- a/ietf/nomcom/fields.py +++ b/ietf/nomcom/fields.py @@ -1,4 +1,9 @@ # Copyright The IETF Trust 2012-2019, All Rights Reserved +# -*- coding: utf-8 -*- + + +from __future__ import absolute_import, print_function, unicode_literals + from django.conf import settings from django.db import models from django.utils.encoding import smart_str @@ -20,7 +25,7 @@ class EncryptedTextField(models.TextField): raise ValueError("Trying to read the NomCom public key: " + str(e)) command = "%s smime -encrypt -in /dev/stdin %s" % (settings.OPENSSL_COMMAND, cert_file) - code, out, error = pipe(command, comments.encode()) + code, out, error = pipe(command, comments.encode('utf-8')) if code != 0: log("openssl error: %s:\n Error %s: %s" %(command, code, error)) if not error: