[Zope3-Users] Generation's install script
Lorenzo Gil Sanchez
lgs at sicem.biz
Sun Apr 30 14:28:27 EDT 2006
I'll answer to myself just in case anybody else will ever have the same
problem:
The problem is that I was adding the folder to the root of the ZODB and
Zope's concept of root is differente. The root object you see using the
ZMI in Zope is a folder called 'Application', which is in the real root
ZODB object. So this fixes my problem:
root = context.connection.root()
app = root['Application']
app['my_folder'] = Folder()
transaction.commit()
Hope it helps
Lorenzo
El jue, 27-04-2006 a las 09:09 +0200, Lorenzo Gil Sanchez escribió:
> Hi list,
>
> I'm trying to use zope3 generations for the first time and I managed to
> get a schema manager working that support the IInstallableSchemaManager
> interface (it is just a subclass of SchemaManager).
>
> So I have an install.py module with an evolve function and it is getting
> called at zope startup. Actually it's called only the first time as it
> should be.
>
> This is how the little script looks like:
>
> import transaction
> from zope.app.folder.folder import Folder
>
> def evolve(context):
> """Install initial basic data structure for the site"""
> print 'Installing application'
> root = context.connection.root()
>
> root['my_folder'] = Folder()
> transaction.commit()
>
>
> The problem is that after zope is started, I go to the ZMI and I don't
> see my new folder there.
>
> The way I test this is:
>
> 1. Stop zope if it was running
> 2. Remove var/Data.fs and var/Data.fs.index
> 3. Start zope
>
> that way my install script is called for sured since I'm running a brand
> new database every time.
>
> Anybody knows what am I doing wrong?
>
> Thanks in advance
>
> Lorenzo Gil
>
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>
More information about the Zope3-users
mailing list