[Grok-dev] Re: megrok.rdb updated

Tim Terlegård tim.terlegard at valentinewebsystems.se
Wed Jun 25 11:26:35 EDT 2008

On Jun 25, 2008, at 5:15 PM, Martijn Faassen wrote:

> Sebastian Ware wrote:
>> This looks a bit verbose, is it really necessary to both add the  
>> object AND set it?
>>   session = rdb.Session()
>>   session.add(department)
>>   self.context.set(department)
>> Is there a reason for this?
> Good question. This is an area that we have been thinking about. I  
> think it might be reasonable to have Container.set also try to add  
> the object to the session directly. They are two operations though:  
> adding an object to the relational database and changing the record  
> so it's added to the container.
> In the ZODB story attaching a persistent object to another one (like  
> adding it to a container) causes it to be persisted, but in the RDB  
> situation these are considered to be separate operations.

Can't self.context.set(department) create the session and add the
deparment to it behind the scenes?


More information about the Grok-dev mailing list