On 6/28/11 1:53 PM, John Fabiani wrote:
> On Tuesday, June 28, 2011 01:19:27 pm Paul McNett wrote:
>> >  My dApp subclass handles getting the connection, and saves it to an
>> >  attribute of the  App 'dbConnection'. Then when I instantiate a bizobj it
>> >  is just 'self.bizOrders = Orders(self.Application.dbConnection)'.
>> >
> How does this help?

Nate was asking how to get the connection object from which to instantiate the 
child 
bizobj. I told him how I do it. I certainly hope it helps!

> You have a subclass of dApp (unless you meant an instance of dApp).

I have a subclass of dApp, that when instantiated sets the dbConnection 
attribute.

> You have a global.

Define "global". Not sure of the relevance...

> If you just used the MainForm.createBizobj() wouldn't you have almost the same
> thing?

The only difference being that the form creates the parent bizobj, but the 
children 
are created by instantiating the parent bizobj. So instead of:

class MyForm(dForm):
   def createBizobjs(self):
     parent = self.addBizobj(BizParent(connection))
     child1 = parent.addChild(BizChild1(connection))
     child2 = parent.addChild(BizChild2(connection))
     grandchild_of_child1 = child1.addChild(...)
     ...

You define the children in the bizobjs themselves, so that whenever you 
instantiate a 
given bizobj you already have the child relationships in place. The form just 
knows 
about whatever "parent" bizobj to instantiate so the above becomes:

class MyForm(dForm):
   def createBizobjs(self):
     self.addBizobj(BizParent(connection))

The end result is of course the same, you just encapsulate the code better IMO.

Paul
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to