Django expects Oracle Ports as strings

This commit is contained in:
klashxx 2017-04-08 12:34:30 +02:00
parent c18e132b21
commit e370c860b8
2 changed files with 8 additions and 5 deletions

View file

@ -97,19 +97,22 @@ def parse(url, engine=None, conn_max_age=0):
hostname = hostname.split(":", 1)[0]
hostname = hostname.replace('%2f', '/').replace('%2F', '/')
# Lookup specified engine.
engine = SCHEMES[url.scheme] if engine is None else engine
port = (str(url.port) if url.port and engine == SCHEMES['oracle']
else url.port)
# Update with environment configuration.
config.update({
'NAME': urlparse.unquote(path or ''),
'USER': urlparse.unquote(url.username or ''),
'PASSWORD': urlparse.unquote(url.password or ''),
'HOST': hostname,
'PORT': url.port or '',
'PORT': port or '',
'CONN_MAX_AGE': conn_max_age,
})
# Lookup specified engine.
engine = SCHEMES[url.scheme] if engine is None else engine
# Pass the query string into OPTIONS.
options = {}
for key, values in query.items():

View file

@ -242,7 +242,7 @@ class DatabaseTestSuite(unittest.TestCase):
assert url['HOST'] == 'oraclehost'
assert url['USER'] == 'scott'
assert url['PASSWORD'] == 'tiger'
assert url['PORT'] == 1521
assert url['PORT'] == '1521'
def test_oracle_gis_parsing(self):
url = 'oraclegis://scott:tiger@oraclehost:1521/hr'