Zope says ZEO_client added BTreeFolder2 has broken product
Hi, I am using a ZEO Client script to add a new BTreeFolder2-1.0.1. The folder is added ok, and populated ok. Through the ZEO-client I inspect the new added folder, and it is fine. But when I check through Zope ZMI interface, it says: 'mybtreef2 (This object from the unknown product is broken!)' If I add the BTreeFolder2 from ZMI (instead of ZEO Script), the folder is displayed correctly. So I guess I'm adding this folder the wrong way. I do the following: <zeo_client_code> import sys sys.path.append("C:\\Program Files\\Zope-2.7.2-0\\lib\\python") # Where I placed BTreeFolder2 product's source code: sys.path.append("C:\\Program Files\\Zope-2.7.2-0\\lib\\python\\Products") # ... some imports were ommited storage = ClientStorage.ClientStorage((ZEO_HOST,ZEO_PORT)) db = DB(storage) cnx = db.open() root = cnx.root() app = root['Application'] teste = app['teste'] if not hasattr(teste,'subfolder2'): from BTreeFolder2 import BTreeFolder2 f = BTreeFolder2.manage_addBTreeFolder(teste,'subfolder2',title='subfolder2') get_transaction().commit() bfolder = teste['subfolder2'] </zeo_client_code> Any mortal sins ? Clues ? best regards, Senra
Rodrigo Dias Arruda Senra wrote:
from BTreeFolder2 import BTreeFolder2
Here's your problem. On the client, you're adding BTreeFolder2.BTreeFolder2 instances. Through the ZMI you're adding Products.BTreeFolder2.BTreeFolder2 instances. These aren't the same ;-) You should use zopectl run instead of your hacked up ZEO client code... Or, at a minimum: import Zope app = Zope.startup() Rather than your own python path hacking. Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
On Tue, 17 Aug 2004 09:21:18 +0200 Chris Withers <chris@simplistix.co.uk> wrote:
Rodrigo Dias Arruda Senra wrote:
from BTreeFolder2 import BTreeFolder2
Here's your problem. On the client, you're adding BTreeFolder2.BTreeFolder2 instances. Through the ZMI you're adding Products.BTreeFolder2.BTreeFolder2 instances.
Great! Thank you Chris, changing the import statement to: 'from Products.BTreeFolder2 import BTreeFolder2' worked like a charm!
You should use zopectl run instead of your hacked up ZEO client code...
I would love too, but unfortunately everything is running in Windows XP.
Or, at a minimum:
import Zope app = Zope.startup()
I did that with the following results: """ Traceback (most recent call last): File "test_zeo.py", line 24, in ? app = Zope.startup() File "C:\Program Files\Zope-2.7.2-0\lib\python\Zope\__init__.py", line 47, in startup _startup() File "C:\Program Files\Zope-2.7.2-0\lib\python\Zope\App\startup.py", line 57, in startup DB = configuration.dbtab.getDatabase('/', is_root=1) AttributeError: 'NoneType' object has no attribute 'getDatabase' """ It seems that configuration.dbtab is None. Perhaps my code lacks additional initialization ? Meanwhile, I moved back to : app = root['Application'] #app = Zope.startup()
Rather than your own python path hacking.
Nevertheless, with your help <wink> it is working now! I'm just trying to build a valid ZEO client code (in the absence of zopectl). I have a Twisted app that pre-process datagrams and deliver the result through ZEO to Zope's web rendering machinery. But I'm always open to any bits of wisdom I can get. best regards, Senra
participants (2)
-
Chris Withers -
Rodrigo Dias Arruda Senra