пускаю сервер:
import os
os.system("start runzeo -a localhost:1234 -f "+"some.fs")
#!/usr/bin/env python
# -*- coding: cp1251 -*-
import ZODB
from ZODB.blob import Blob
import transaction
from ZEO import ClientStorage
from ZODB import DB
blob_dir = "data"
addr = 'localhost', 1234
storage = ClientStorage.ClientStorage(addr,blob_dir=blob_dir,shared_blob_dir=None)
db = DB(storage)
connection = db.open()
root = connection.root()
blob = Blob()
f = blob.open("w")
f.write("Hi, Blob!")
f.close()
nothing = transaction.begin()
root["blb"]=blob
root["a"]=123123
nothing.commit()
connection.close()
db.pack()
db.close()
Traceback (most recent call last):
File “aa.py”, line 31, in <module>
nothing.commit()
File “c:\comp\python26\lib\site-packages\transaction-1.1.0-py2.6.egg\transaction\_transaction.py”, line 329, in commit
self._commitResources()
File “c:\comp\python26\lib\site-packages\transaction-1.1.0-py2.6.egg\transaction\_transaction.py”, line 423, in _commitResources
rm.commit(self)
File “c:\comp\python26\lib\site-packages\zodb3-3.10.0b1-py2.6-win32.egg\ZODB\Connection.py”, line 553, in commit
self._commit(transaction)
File “c:\comp\python26\lib\site-packages\zodb3-3.10.0b1-py2.6-win32.egg\ZODB\Connection.py”, line 601, in _commit
self._store_objects(ObjectWriter(obj), transaction)
File “c:\comp\python26\lib\site-packages\zodb3-3.10.0b1-py2.6-win32.egg\ZODB\Connection.py”, line 643, in _store_objects
repr(self._storage))
ZODB.POSException.Unsupported: Storing Blobs in <ZEO.ClientStorage.ClientStorage object at 0x00D00DF0> is not supported.
Я что-то не так делаю? может клиент нужен друой?
С FileStorage все проходит на ура (но несколько иначе):
storage = FileStorage.FileStorage("data/dd.fs")
blob_storage = BlobStorage(blob_dir, storage)
db = DB(blob_storage)
неправильный тип ZEO.ClientStorage.ClientStorage, или надо включить поддержку.
Как все-таки делать блобы? И возможно-ли их подключить?