Re: Re: RefEngine persistance bug?

Dieter Maurer <[email protected]>
Newsgroups gmane.comp.web.zope.plone.archetypes.devel
Message-ID <[email protected]>
Raphael Ritz wrote at 2006-1-27 15:33 +0100:
>Raphael Ritz wrote:
> ...
>What do I need to call once I have a valid reference object
>(a 'Reference' instance) at hand to get it persisted?

Any new persistent object is persisted as soon as it becomes
part of the value of another persistent object when that object
is written to the ZODB.

> ...
>> (which works fine) with the only difference that I want
>> it the other way around, i.e,
>> 
>>    ref = target.addReference(self, ref_name)
>> 
>> i.e., in a method of 'self' I have a handle on an object
>> 'target' for which I want to set the reference.
>> But at first glance it looks like the reference isn't set.
>> 
>> Debuging this, I figured out that initially, the reference
>> is created (by calling 'print ref' right after adding it
>> shows up corectly in the log) but when browsing to the affected
>> objects later, the reference is gone :-(

Where does your "target" come from? Is it from the same
ZODB connection than "self" (you verify by comparing "self._p_jar"
and "target._p_jar").

Beware: you must never use persistent objects outside a ZODB connection

>> Anybody a clue why?
>> 
>> Any idea how to get it persistent?
>> (all I tried so far was to set 'target._p_changed=1' but this didn't
>> change things in any way)

It looks as if "target" itself were not persisted.

-- 
Dieter


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.