[BlueBream] Re : can't persist

Christophe Combelles ccomb at free.fr
Thu Jul 1 06:49:33 EDT 2010


rootFolder is a class or factory to create a rootfolder, but this is just an applicative root folder with a specific interface, just a convention. The zodb root object is a different object which is always present when you open an empty zodb, and that you'll be able to access with IDatabaseOpenedWithRoot event.

If you want to retrieve the root object or any possible rootFolder, you can use some hooks such as getSite or getRoot, I don't remember where they are

Christophe

----- Reply message -----
De : "Jim Pharis" <binbrain at gmail.com>
Date : mer., juin 30, 2010 23:05
Objet : [BlueBream] can't persist
Pour : "Christophe Combelles" <ccomb at free.fr>
Cc : <bluebream at zope.org>


So I'm mistaken about the purpose of the rootFolder method then. However, I
can't really use the IDataOpenedWithRootEvent cleanly because I don't want
the root obj when the connection is opened, I want it later. Therefore,
getting at the root obj still isn't real obvious to me in this situation.

On Wed, Jun 30, 2010 at 4:06 PM, Christophe Combelles <ccomb at free.fr> wrote:

> Le 30/06/2010 21:47, Jim Pharis a écrit :
> > No, I don't see the changes. Maybe I should be more specific about what
> > I'm doing.
> >
> > I have an AdminUtility registered with the below method that I call from
> > a view. If I inspect the root object after that method exists newsite
> > isn't in there.
> >
> > from zope.site.folder import rootFolder
> > def install(self)
> >          newsite = NewSite()
> >          newsite.setSiteManager(LocalSiteManager(newsite))
> >          root = rootFolder()
> >          import pdb; pdb.set_trace()
> >          root['newsite'] = newsite
> >          root._p_changed = True
> >          transaction.commit()
>
>
> You're creating a root object in a local variable, and this variable is
> destroyed at the end of the function. You should retrieve the root instead
> of
> creating it, since an empty ZODB always has a root object.
>
>
> http://bluebream.zope.org/doc/1.0/faq.html#how-do-i-automatically-create-some-needed-object-at-application-startup
>
> >
> >
> > On Wed, Jun 30, 2010 at 3:11 PM, Christophe Combelles <ccomb at free.fr
> > <mailto:ccomb at free.fr>> wrote:
> >
> >     Le 30/06/2010 20:31, Jim Pharis a écrit :
> >      > I'm trying out BlueBream 1.0b2 and I'm running into a problem with
> >      > Persistent objects. The installation is pretty out of the box at
> this
> >      > point. When I use .\bin\paster shell debug.ini I seem to be able
> to
> >      > create Persistent objects and transaction.commit and changed
> >     objects are
> >      > properly committed. However, when I start using either
> .\bin\paster
> >      > serve debug.ini or .\bin\paster serve deploy.ini, no matter what
> >     I do to
> >      > Persistent objects transaction.commit() returns None. I noticed
> that
> >      > even if I directly set obj._p_changed=1 it doesn't work, and if I
> >     look
> >      > at _p_changed right away, I see its been reverted back to False.
> >     What am
> >      > I doing wrong here?
> >
> >     Hi!
> >
> >     transaction.commit() is not supposed to return anything, don't you
> >     see the
> >     changes in your application after ending the debug session and
> >     returning to the
> >     paster serve ?
> >
> >     Christophe
> >
> >      >
> >      > TIA,
> >      >
> >      > - Jim
> >      >
> >      >
> >      >
> >      > _______________________________________________
> >      > bluebream mailing list
> >      > bluebream at zope.org <mailto:bluebream at zope.org>
> >      > https://mail.zope.org/mailman/listinfo/bluebream
> >
> >     _______________________________________________
> >     bluebream mailing list
> >     bluebream at zope.org <mailto:bluebream at zope.org>
> >     https://mail.zope.org/mailman/listinfo/bluebream
> >
> >
>
> _______________________________________________
> bluebream mailing list
> bluebream at zope.org
> https://mail.zope.org/mailman/listinfo/bluebream
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/bluebream/attachments/20100701/f87b9bde/attachment.html 


More information about the bluebream mailing list