Commit d1580fde authored by Jim Fulton's avatar Jim Fulton Committed by GitHub

Merge pull request #16 from Pylons/fix-zconfig

Fixed: changes in 2.2 broke the zconfig resolver.
parents 2fe5ad0b ba261a69
......@@ -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,6 +50,7 @@ def _get_dbkw(kw):
if parameter in kw:
v = kw.pop(parameter)
if parameter.startswith('connection_'):
if not isinstance(v, int):
if parameters[parameter] in bytes_parameters:
v = _parse_bytes(v)
else:
......
......@@ -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