[ZODB-Dev] Can ZEO serve Ape storage?
zhimin at iss.nus.edu.sg
zhimin at iss.nus.edu.sg
Wed Jun 4 17:07:51 EDT 2003
Hello,
Can ZEO serve Ape storage? How to do it?
I tried to serve Ape file system storage and sql storage through ZEO but
failed. The error I got for file system storage and sql storage are the
same as follow:
------
2003-06-04T15:46:21 INFO(0) ZCS:1268 ClientStorage (pid=1268) created
RW/normalfor storage: 'fs'
------
2003-06-04T15:46:21 INFO(0) ZEC:fs ClientCache: storage='fs',
size=20971520; file[0]=None
------
2003-06-04T15:46:21 INFO(0) ZCS:1268 Testing connection <ManagedConnection
('127.0.0.1', 9001)>
------
2003-06-04T15:46:51 ERROR(200) zrpc:1268 CW: error in notifyConnected
(('localhost', 9001))
Traceback (innermost last):
File C:\Program Files\Zope\bin\ZEO\zrpc\client.py, line 468, in
notify_client
File C:\Program Files\Zope\bin\ZEO\ClientStorage.py, line 351, in
notifyConnected (Object: FS)
File C:\Program Files\Zope\bin\ZEO\ServerStub.py, line 49, in get_info
File C:\Program Files\Zope\bin\ZEO\zrpc\connection.py, line 322, in call
AttributeError: ApeStorage instance has no attribute
'supportsTransactionalUndo'
------
My system:
Zope = (Zope 2.6.1 (binary release, python 2.1, win32-x86), python 2.1.3,
win32) , running at localhost
ZODB = 3.1.1, included in Zope
ZEO = 2.0.1b1, also running at localhost
DBTab = 1.2
Ape = 0.6
StorageConfig.py (in lib\python\ZEO)
-----------------------------
import os
import sys
# Import the copy of apelib from 'lib' by temporarily changing sys.path.
old_path = sys.path[:]
sys.path.insert(0, os.path.join('C:/Program
Files/ZEO/lib/python/Products/Ape', 'lib'))
try:
import apelib
finally:
# Restore sys.path
sys.path[:] = old_path
from apelib.zope2.setup import patches, dbtab
patches.applyPatches()
from apelib.zodb3.storage import ApeStorage
from apelib.zodb3.resource import StaticResource
from apelib.zope2.fsmapper import createMapper
from apelib.zope2.sqlmapper import createConnectorMapper
from apelib.sql.dbapi import DBAPIConnector
CLIENT_HOME = 'C:/Program Files/ZEO/var'
# file storage
envpath = os.path.join(CLIENT_HOME, 'Data.fs')
main_storage = FileStorage(envpath)
# file system storage
envpath = os.path.join(CLIENT_HOME, 'Storages', 'FS')
dm, conns = createMapper(envpath)
assert len(conns) == 1
resource = StaticResource(dm)
fs_storage = ApeStorage(resource, conns)
# mysql storage
dbapi_module = 'MySQLdb'
dbapi_kwparams = {'host':'localhost', 'db':'test', 'user':'abc',
'passwd':'abc'}
conn = DBAPIConnector(dbapi_module, kwparams=dbapi_kwparams)
dm, conns, gws = createConnectorMapper(conn)
resource = StaticResource(dm)
mysql_storage = ApeStorage(resource, conns)
start_zeo.bat
-----------------------------
"C:\Program Files\Zope\bin\python.exe" "C:\Program
Files\Zope\lib\python\ZEO\start.py" -p 9001 -S
main=StorageConfig:main_storage -S session=StorageConfig:session_storage -S
bdb=StorageConfig:bdb_storage -S fs=StorageConfig:fs_storage -S
mysql=StorageConfig:mysql_storage
dbtab.conf
-----------------------------
[Storage: Main]
type=ClientStorage
addr=zeo://localhost:9001
storage=main
[Database: Main]
cache_size=4000
mount_paths=/
[Storage: FS]
type=ClientStorage
addr=zeo://localhost:9001
storage=fs
[Database: FS]
class=apelib.zodb3.db.ApeDB
cache_size=4000
mount_paths=/Storages/FS
container_class=OFS.Folder.Folder
[Storage: MySQL]
type=ClientStorage
addr=zeo://localhost:9001
storage=mysql
[Database: MySQL]
class=apelib.zodb3.db.ApeDB
cache_size=4000
mount_paths=/Storages/MySQL
Thanks,
Zhi Min
More information about the ZODB-Dev
mailing list