py3: use b64encode (#46576)

This commit is contained in:
Thomas NOËL 2020-09-11 12:06:15 +02:00
parent 29da935811
commit 5a10ff7d98
1 changed files with 4 additions and 3 deletions

View File

@ -14,10 +14,11 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import requests
import base64
from datetime import datetime
import logging
import re
import requests
from django.views.generic import DetailView as GenericDetailView
from django.utils.decorators import method_decorator
@ -165,7 +166,7 @@ class ResourceView(DetailView):
if page and not empty_page: # add last page, if it contains values
document += page
document += '</body></html>'
encodedFile = document.encode('utf-8').encode('base64')
encodedFile = base64.b64encode(document.encode('utf-8'))
fileFormat = 'html'
if debug:
@ -569,7 +570,7 @@ class DebugView(DetailView):
document += page
document += '</body></html>'
logger.debug('DOCUMENT HTML %r ', document)
encodedFile = document.encode('utf-8').encode('base64')
encodedFile = base64.b64encode(document.encode('utf-8'))
fileFormat = 'html'
if debug: