Commit ba261a69 authored by Jim Fulton's avatar Jim Fulton

Fixed: changes in 2.2 broke the zconfig resolver.

parent 18a3a7ce
......@@ -4,7 +4,7 @@
2.2.1 (unreleased)
------------------
- Nothing changed yet.
- Fixed: changes in 2.2 broke the zconfig resolver.
2.2 (2017-04-17)
......
......@@ -50,10 +50,11 @@ def _get_dbkw(kw):
if parameter in kw:
v = kw.pop(parameter)
if parameter.startswith('connection_'):
if parameters[parameter] in bytes_parameters:
v = _parse_bytes(v)
else:
v = int(v)
if not isinstance(v, int):
if parameters[parameter] in bytes_parameters:
v = _parse_bytes(v)
else:
v = int(v)
dbkw[parameters[parameter]] = v
if kw:
......
......@@ -490,6 +490,31 @@ class TestZConfigURIResolver(unittest.TestCase):
expect[cparameter] *= 1<<20
self.assertEqual(dbkw, expect)
def test_database_integration_because_ints(self):
from zodburi import resolve_uri
self.tmp.write(b"""
<zodb>
<mappingstorage>
</mappingstorage>
</zodb>
""")
self.tmp.flush()
from zodburi import resolve_uri
factory, dbkw = resolve_uri('zconfig://%s' % self.tmp.name)
storage = factory()
from ZODB.MappingStorage import MappingStorage
self.assertTrue(isinstance(storage, MappingStorage))
self.assertEqual(dbkw,
{'cache_size': 5000,
'cache_size_bytes': 0,
'historical_cache_size': 1000,
'historical_cache_size_bytes': 0,
'historical_pool_size': 3,
'historical_timeout': 300,
'large_record_size': 16777216,
'pool_size': 7,
'database_name': 'unnamed'})
class TestMappingStorageURIResolver(Base, unittest.TestCase):
def _getTargetClass(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment