Commit 3963e85d authored by Jim Fulton's avatar Jim Fulton

Bug Fixed: The runzeo script didn't work without a configuration file.

Simplified the file-storage configuration a bit.  Eliminated
duplication of defaults between the Python and ZConfig interfaces.
parent 406d75f1
......@@ -2,6 +2,14 @@
Change History
================
3.9.0c1 (2009-08-06)
====================
Bugs Fixed
----------
- The runzeo script didn't work without a configuration file.
3.9.0b5 (2009-08-06)
====================
......
......@@ -79,10 +79,7 @@ class ZEOOptionsMixin:
def __init__(self, name, path):
self._name = name
self.path = path
self.create = 0
self.read_only = 0
self.stop = None
self.quota = None
def getSectionName(self):
return self._name
if not self.storages:
......@@ -91,7 +88,12 @@ class ZEOOptionsMixin:
conf = FileStorage(FSConfig(name, arg))
self.storages.append(conf)
testing_exit_immediately = False
def handle_test(self, *args):
self.testing_exit_immediately = True
def add_zeo_options(self):
self.add(None, None, None, "test", self.handle_test)
self.add(None, None, "a:", "address=", self.handle_address)
self.add(None, None, "f:", "filename=", self.handle_filename)
self.add("family", "zeo.address.family")
......@@ -249,6 +251,9 @@ class ZEOServer:
self.server = create_server(self.storages, self.options)
def loop_forever(self):
if self.options.testing_exit_immediately:
print "testing exit immediately"
else:
asyncore.loop()
def handle_sigterm(self):
......
......@@ -33,6 +33,7 @@ import persistent
import shutil
import signal
import stat
import sys
import tempfile
import threading
import time
......@@ -1181,6 +1182,31 @@ def client_asyncore_thread_has_name():
1
"""
def runzeo_without_configfile():
"""
>>> open('runzeo', 'w').write('''
... import sys
... sys.path[:] = %r
... import ZEO.runzeo
... ZEO.runzeo.main(sys.argv[1:])
... ''' % sys.path)
>>> import subprocess, re
>>> print re.sub('\d\d+|[:]', '', subprocess.Popen(
... [sys.executable, 'runzeo', '-a./s', '-ft', '--test'],
... stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
... ).stdout.read()),
------
--T INFO ZEO.runzeo () opening storage '1' using FileStorage
------
--T INFO ZEO.StorageServer () StorageServer created RW with storages 1RWt
------
--T INFO ZEO.zrpc () listening on ./s
------
--T INFO ZEO.runzeo () closing storage '1'
testing exit immediately
"""
slow_test_classes = [
BlobAdaptedFileStorageTests, BlobWritableCacheTests,
DemoStorageTests, FileStorageTests, MappingStorageTests,
......
......@@ -23,13 +23,13 @@
use a BlobStorage to provide blob support.)
</description>
</key>
<key name="create" datatype="boolean" default="false">
<key name="create" datatype="boolean">
<description>
Flag that indicates whether the storage should be truncated if
it already exists.
</description>
</key>
<key name="read-only" datatype="boolean" default="false">
<key name="read-only" datatype="boolean">
<description>
If true, only reads may be executed against the storage. Note
that the "pack" operation is not considered a write operation
......
......@@ -154,19 +154,19 @@ class FileStorage(BaseConfig):
def open(self):
from ZODB.FileStorage import FileStorage
config = self.config
options = {}
if self.config.packer:
m, name = self.config.packer.rsplit('.', 1)
if getattr(config, 'packer', None):
m, name = config.packer.rsplit('.', 1)
options['packer'] = getattr(__import__(m, {}, {}, ['*']), name)
return FileStorage(self.config.path,
create=self.config.create,
read_only=self.config.read_only,
quota=self.config.quota,
pack_gc=self.config.pack_gc,
pack_keep_old=self.config.pack_keep_old,
blob_dir=self.config.blob_dir,
**options)
for name in ('blob_dir', 'create', 'read_only', 'quota', 'pack_gc',
'pack_keep_old'):
v = getattr(config, name, self)
if v is not self:
options[name] = v
return FileStorage(config.path, **options)
class BlobStorage(BaseConfig):
......
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