[BlueBream] can't persist
Christophe Combelles
ccomb at free.fr
Wed Jun 30 16:06:03 EDT 2010
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
>
>
More information about the bluebream
mailing list