[Zope] /temp_folder for ZEO session

Chris McDonough chrism at zopemafia.com
Tue Oct 21 22:30:19 EDT 2003


On Tue, 2003-10-21 at 19:06, Adam Szpakowski wrote:
> Hi,
> 
> I'm struggling with seting up ZEO environment. For now I set up a Zope 2.7b2 
> working as ZEO client with ZEO server. In zope.conf I have two zobd_db. One 
> for mount point "/" and ZEO client and the second one for mount point "/
> temp_folder" as TemporaryFolder. With Zope everything works fine. In database 
> management i have two bases and in zeo logs connections are logged.
> 
> Now I try to set up another connection to the same ZEO server from clean 
> python... and get stuck with OFS/Application.py trying to set object 
> 'session_data' after executing Zope.startup(). 

When you said "clean python", I wasn't expecting to see any mention of
"OFS.Application". ;-)  

> If I understand correctly the problem lies in a Data.fs. Zope modifies Data.fs 
> and remove /temp_folder becouse it is using the second database for it 
> (TemporaryFolder).

That's right...

> For a test I create another ZEO server with no database file. ZEO create the 
> database with temp_folder in it and the problem do not appear (connection 
> from python was succesfull). After that I attached the Zope (as ZEO client) 
> to this ZEO server and the problem show up again.
> 
> I use quite typical config for ZEO:
> 
> <custom_zodb.py>
>     import ZServer
>     import ZEO.ClientStorage
>     Storage=ZEO.ClientStorage.ClientStorage(('localhost',7770),storage='main')
> 
> and bind from python to ZODB (through ZEO) using:
>     Zope.startup()
>     app=Zope.app()

OK, first of all, you don't need to use custom_zodb.py in Zope
2.7.0b2+.  Use zope.conf and then use the following to enact the options
in the config file.

def setup(configfile_name):
    from Zope.Startup.options import ZopeOptions
    from Zope.Startup import handlers as h
    from App import config
    opts=ZopeOptions()
    opts.configfile=configfile_name
    opts.realize()
    h.handleConfig(opts.configroot,opts.confighandlers)
    config.setConfiguration(opts.configroot)
    from Zope.Startup import dropPrivileges
    dropPrivileges(opts.configroot)

Call this from your Python startup procedure.


> 
> So my question is: How can I create from python a TemporaryStorage for ZEO 
> client and specify it's mount point as /temp_folder?

Just edit the zope.conf and specify the right stuff...

> 
> I've searched the net and newsgroups (and Zope code) but there is no clear 
> solution for me. I would like to mimic the behaviour of ZConfig for zope.conf 
> and it's zodb tags. I suppose that the answer is in Zope code but 
> unfortunetly its quite comlicated and after few hours of going through it I 
> think that's it is time to call for help ;).
> 
> Thank's in advance

HTH,

- C





More information about the Zope mailing list