Thanks for your help Christophe. I found a getRoot in zope.traversal.api but it requires the context of a child a object that is Persistent. Thus, I couldn't use the context in my none persistent code to find the parent Persistent root. What I ended up doing was hooking into IDatabaseOpenedWithRootEvent and registering a utility with my connection info. It seems strange to have to do it this way, but it works. <br>
<br>It'd be nice for there to already be a utility registered for me in the GlobalSiteManager that has the Persistent connection info rather then having to register it myself.<br><br>- Jim<br><br><div class="gmail_quote">
On Thu, Jul 1, 2010 at 6:49 AM, Christophe Combelles <span dir="ltr"><<a href="mailto:ccomb@free.fr">ccomb@free.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
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.<br>
<br>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<br><br>Christophe<br><br>----- Reply message -----<br>De : "Jim Pharis" <<a href="mailto:binbrain@gmail.com" target="_blank">binbrain@gmail.com</a>><br>
Date : mer., juin 30, 2010 23:05<br>Objet : [BlueBream] can't persist<br>Pour : "Christophe Combelles" <<a href="mailto:ccomb@free.fr" target="_blank">ccomb@free.fr</a>><br>Cc : <<a href="mailto:bluebream@zope.org" target="_blank">bluebream@zope.org</a>><div>
<div></div><div class="h5"><br><br><br>So I'm mistaken about the purpose of the rootFolder method then. However, I<br>can't really use the IDataOpenedWithRootEvent cleanly because I don't want<br>the root obj when the connection is opened, I want it later. Therefore,<br>
getting at the root obj still isn't real obvious to me in this situation.<br><br>On Wed, Jun 30, 2010 at 4:06 PM, Christophe Combelles <<a href="mailto:ccomb@free.fr" target="_blank">ccomb@free.fr</a>> wrote:<br>
<br>> Le 30/06/2010 21:47, Jim Pharis a écrit :<br>> > No, I don't see the changes. Maybe I should be more specific about what<br>> > I'm doing.<br>> ><br>> > I have an AdminUtility registered with the below method that I call from<br>
> > a view. If I inspect the root object after that method exists newsite<br>> > isn't in there.<br>> ><br>> > from zope.site.folder import rootFolder<br>> > def install(self)<br>> > newsite = NewSite()<br>
> > newsite.setSiteManager(LocalSiteManager(newsite))<br>> > root = rootFolder()<br>> > import pdb; pdb.set_trace()<br>> > root['newsite'] = newsite<br>> > root._p_changed = True<br>
> > transaction.commit()<br>><br>><br>> You're creating a root object in a local variable, and this variable is<br>> destroyed at the end of the function. You should retrieve the root instead<br>
> of<br>> creating it, since an empty ZODB always has a root object.<br>><br>><br>> <a href="http://bluebream.zope.org/doc/1.0/faq.html#how-do-i-automatically-create-some-needed-object-at-application-startup" target="_blank">http://bluebream.zope.org/doc/1.0/faq.html#how-do-i-automatically-create-some-needed-object-at-application-startup</a><br>
><br>> ><br>> ><br>> > On Wed, Jun 30, 2010 at 3:11 PM, Christophe Combelles <<a href="mailto:ccomb@free.fr" target="_blank">ccomb@free.fr</a><br>> > <mailto:<a href="mailto:ccomb@free.fr" target="_blank">ccomb@free.fr</a>>> wrote:<br>
> ><br>> > Le 30/06/2010 20:31, Jim Pharis a écrit :<br>> > > I'm trying out BlueBream 1.0b2 and I'm running into a problem with<br>> > > Persistent objects. The installation is pretty out of the box at<br>
> this<br>> > > point. When I use .\bin\paster shell debug.ini I seem to be able<br>> to<br>> > > create Persistent objects and transaction.commit and changed<br>> > objects are<br>
> > > properly committed. However, when I start using either<br>> .\bin\paster<br>> > > serve debug.ini or .\bin\paster serve deploy.ini, no matter what<br>> > I do to<br>> > > Persistent objects transaction.commit() returns None. I noticed<br>
> that<br>> > > even if I directly set obj._p_changed=1 it doesn't work, and if I<br>> > look<br>> > > at _p_changed right away, I see its been reverted back to False.<br>> > What am<br>
> > > I doing wrong here?<br>> ><br>> > Hi!<br>> ><br>> > transaction.commit() is not supposed to return anything, don't you<br>> > see the<br>> > changes in your application after ending the debug session and<br>
> > returning to the<br>> > paster serve ?<br>> ><br>> > Christophe<br>> ><br>> > ><br>> > > TIA,<br>> > ><br>> > > - Jim<br>
> > ><br>> > ><br>> > ><br>> > > _______________________________________________<br>> > > bluebream mailing list<br>> > > <a href="mailto:bluebream@zope.org" target="_blank">bluebream@zope.org</a> <mailto:<a href="mailto:bluebream@zope.org" target="_blank">bluebream@zope.org</a>><br>
> > > <a href="https://mail.zope.org/mailman/listinfo/bluebream" target="_blank">https://mail.zope.org/mailman/listinfo/bluebream</a><br>> ><br>> > _______________________________________________<br>
> > bluebream mailing list<br>> > <a href="mailto:bluebream@zope.org" target="_blank">bluebream@zope.org</a> <mailto:<a href="mailto:bluebream@zope.org" target="_blank">bluebream@zope.org</a>><br>
> > <a href="https://mail.zope.org/mailman/listinfo/bluebream" target="_blank">https://mail.zope.org/mailman/listinfo/bluebream</a><br>> ><br>> ><br>><br>> _______________________________________________<br>
> bluebream mailing list<br>> <a href="mailto:bluebream@zope.org" target="_blank">bluebream@zope.org</a><br>> <a href="https://mail.zope.org/mailman/listinfo/bluebream" target="_blank">https://mail.zope.org/mailman/listinfo/bluebream</a><br>
><br><br><br></div></div><br>_______________________________________________<br>
bluebream mailing list<br>
<a href="mailto:bluebream@zope.org">bluebream@zope.org</a><br>
<a href="https://mail.zope.org/mailman/listinfo/bluebream" target="_blank">https://mail.zope.org/mailman/listinfo/bluebream</a><br>
<br></blockquote></div><br>