[Grok-dev] Re: megrok.rdb updated
Martijn Faassen
faassen at startifact.com
Wed Jun 25 11:15:11 EDT 2008
Sebastian Ware wrote:
> 25 jun 2008 kl. 14.46 skrev Martijn Faassen:
>>
>> I also updated the rdbexample to make use of the new code, though it's
>> rather hard to play with it as it has the horrible text-only screens
>> instead of proper page templates:
>>
>> http://svn.zope.org/grokapps/rdbexample/trunk
>
> FWIW I find your sample application excellent because of it's simplicity!
Thanks!
It's not just my sample application; quite a few grokkerdam sprinters
worked on it. Anyway, I don't expect the introduction of actual
templates will make it harder to understand.
> 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.
Regards,
Martijn
More information about the Grok-dev
mailing list