[ZODB-Dev] Accessing Plone through ZEO back door?

Kapil Thangavelu hazmat at objectrealms.net
Sun Aug 22 03:36:29 EDT 2004


On Aug 22, 2004, at 1:28 AM, Jim Roepcke wrote:

> On Aug 21, 2004, at 4:37 PM, Kirby Urner wrote:
>
>> Let me see if I've got this straight:  Zeo serves the ZODB using 
>> ClientStorage, but isn't aware of Products, which are at the Zope 
>> layer (and above).  So the reason I get errors when doing
>
> The ZEO *server* isn't aware of products, but ZEO clients are.  ZEO 
> clients is another way of saying "Zope instance that connects to a 
> remote ZODB", where remote ZODB implies "ZEO server".


fwiw, the server does need to be aware of the products if your relying 
on application level conflict resolution, for which the server needs to 
load the class def to invoke the appropriate methods.

>
> Your script needs to make sure it adds SOFTWARE_HOME (which is 
> Zope/lib/python) to the sys.path, if it isn't already there.  I can't 
> remember if you have to add anything in the INSTANCE_HOME if you're 
> using an INSTANCE_HOME, or if Zope figures that out.
>

fwiw, on 2.7 i setup env vars before invoking scripts (sometimes a 
front end script)
export INSTANCE_HOME=/somewhere/
export SOFTWARE_HOME=/somewhereelse
export PYTHONPATH=$SOFTWARE_HOME:$PYTHONPATH

#script start

#!/bin/env python2.3

import Zope, os
Zope.configure( os.path.join( os.environ['INSTANCE_HOME'], 'etc', 
'zope.conf') )
app = Zope.app()

which will load up the conf and setup the products path properly (ie if 
multiple product directories) and use whatever zodb is configured in 
zope.conf.



>>   >>> storage = ClientStorage.ClientStorage(('localhost',8100))
>>   >>> db = DB(storage)
>>   >>> conn = db.open()
>>   >>> root = conn.root()
>>   >>> app = root['Application']
>>   >>> app.reset()
>
> Since this code is acting as a client to the ZEO server, it does need 
> the products.
>
> Jim
>
> --
> Jim Roepcke
> Roepcke Computing Solutions: http://www.roepcke.com/
> Jim's weblog: http://jim.roepcke.com/
>
> _______________________________________________
> For more information about ZODB, see the ZODB Wiki:
> http://www.zope.org/Wikis/ZODB/
>
> ZODB-Dev mailing list  -  ZODB-Dev at zope.org
> http://mail.zope.org/mailman/listinfo/zodb-dev
>
>
Kapil Thangavelu <hazmat at objectrealms.net>       Vision Implemented
objectrealms.net <http://www.objectrealms.net>



More information about the ZODB-Dev mailing list