﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27771	Problem with unicode literals and EMAIL_PORT	Michal Čihař	nobody	"When your settings.py looks like:

{{{
from __future__ import unicode_literals
EMAIL_HOST= 'localhost'
EMAIL_PORT = '587'
}}}

You end up with error when sending mail:

{{{
File ""/opt/weblate/.local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py"" in open
  58.             self.connection = connection_class(self.host, self.port, **connection_params)

File ""/usr/lib/python2.7/smtplib.py"" in __init__
  256.             (code, msg) = self.connect(host, port)

File ""/usr/lib/python2.7/smtplib.py"" in connect
  316.         self.sock = self._get_socket(host, port, self.timeout)

File ""/usr/lib/python2.7/smtplib.py"" in _get_socket
  291.         return socket.create_connection((host, port), timeout)

File ""/usr/lib/python2.7/socket.py"" in create_connection
  553.     for res in getaddrinfo(host, port, 0, SOCK_STREAM):

Exception Type: error at /accounts/register/
Exception Value: getaddrinfo() argument 2 must be integer or string
}}}

This is caused by fact that that getaddrinfo happily accepts int or string, but not unicode literals as port (it doesn't have problem with unicode literals as hostname though):

{{{
>>> from __future__ import unicode_literals
>>> import socket
>>> socket.getaddrinfo('localhost', '567', 0, socket.SOCK_STREAM)
Traceback (most recent call last):
  File ""<stdin>"", line 1, in <module>
socket.error: getaddrinfo() argument 2 must be integer or string
}}}

I think Django should prevent this configuration error, or at least properly tell where the problem is.

Originally reported at https://github.com/WeblateOrg/weblate/issues/1330"	Cleanup/optimization	closed	Core (Mail)	1.10	Normal	wontfix			Unreviewed	0	0	0	0	0	0
