Commit ae899e2a authored by Jeremy Hylton's avatar Jeremy Hylton

Finish configuration for DemoStorage.

There's now concrete test of recursively defined section types.
parent 8713bd6a
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
############################################################################## ##############################################################################
"""Open database and storage from a configuration. """Open database and storage from a configuration.
$Id: config.py,v 1.2 2003/01/03 21:19:06 fdrake Exp $""" $Id: config.py,v 1.3 2003/01/06 22:42:17 jeremy Exp $"""
import os import os
import StringIO import StringIO
...@@ -63,6 +63,18 @@ class MappingStorage(StorageConfig): ...@@ -63,6 +63,18 @@ class MappingStorage(StorageConfig):
from ZODB.MappingStorage import MappingStorage from ZODB.MappingStorage import MappingStorage
return MappingStorage(self.config.name) return MappingStorage(self.config.name)
class DemoStorage(StorageConfig):
def open(self):
from ZODB.DemoStorage import DemoStorage
if self.config.base:
base = self.config.base.open()
else:
base = None
return DemoStorage(self.config.name,
base=base,
quota=self.config.quota)
class FileStorage(StorageConfig): class FileStorage(StorageConfig):
def open(self): def open(self):
......
...@@ -56,8 +56,7 @@ ...@@ -56,8 +56,7 @@
<key name="read_only_fallback" datatype="boolean" default="off"/> <key name="read_only_fallback" datatype="boolean" default="off"/>
</sectiontype> </sectiontype>
<sectiontype type="demostorage"> <sectiontype type="demostorage" datatype="ZODB.config.DemoStorage">
<!--datatype="ZODB.config.DemoStorage"-->
<key name="name" default="Demo Storage"/> <key name="name" default="Demo Storage"/>
<section type="storage" name="*" attribute="base"/> <section type="storage" name="*" attribute="base"/>
<key name="quota" datatype="integer"/> <key name="quota" datatype="integer"/>
......
...@@ -76,6 +76,15 @@ class ZODBConfigTest(ConfigTestBase): ...@@ -76,6 +76,15 @@ class ZODBConfigTest(ConfigTestBase):
""" """
self.assertRaises(ClientDisconnected, self._test, cfg) self.assertRaises(ClientDisconnected, self._test, cfg)
def test_demo_config(self):
cfg = """
<demostorage>
name foo
<mappingstorage/>
</demostorage>
"""
self._test(cfg)
class BDBConfigTest(ConfigTestBase): class BDBConfigTest(ConfigTestBase):
def setUp(self): def setUp(self):
self._path = tempfile.mktemp() self._path = tempfile.mktemp()
......
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