On 8/12/10 10:38 PM, M. Milanuk wrote: > So... I'm progressing through the Appwizard portion of the tutorial, and > I'm at the point where I'm editing ui/FrmRecipes.py (I think, it kinda > changes from one file to another in there without a lot of warning), and > I'm seeing this in the tutorial document: > > 24 def afterInit(self): > 25 if not self.Testing: > 26 app = self.Application > 27 self.addBizobj(app.biz.Recipes(app.dbConnection)) > 28 > 29 # Add the separate categories bizobj, to give us the list of all > 30 # recipe categories: > 31 self.addBizobj(app.biz.Reccats(app.dbConnection)) > 32 self.requeryCategories() > 33 self.super() > > vs. this in the Appwizard-generated FrmRecipes.py: > > def afterInit(self): > if not self.Testing: > # Instantiate the bizobj and register it with dForm, > and then let the > # superclass take over. > app = self.Application > bizRecipes = app.biz.Recipes(app.dbConnection) > self.addBizobj(bizRecipes) > self.super()
The latter one instantiates the Recipes bizobj, and binds it to the local name bizRecipes. It then adds the instance to the form (self.addBizobj). The former (tutorial) version does this in one line, and doesn't bother binding it to a local name (line 27). > Is this > > self.addBizobj(app.biz.Reccats(app.dbConnection)) > > equivalent to this > > bizRecipes = app.biz.Recipes(app.dbConnection) > > ? No. These are the equivalent code pieces: > 27 self.addBizobj(app.biz.Recipes(app.dbConnection)) and > bizRecipes = app.biz.Recipes(app.dbConnection) > self.addBizobj(bizRecipes) The tutorial code adds the Recipes bizobj and then adds an additional bizobj (Reccats). > What about the self.requeryCategories() vs. self.addBizobj(bizRecipes)? Two completely different things. self.requeryCategories() requeries the Reccats bizobj; self.addBizobj(bizRecipes) adds the Recipes bizobj to the form. > I guess things are just enough different that its got me wondering if > I'm even looking at the right file? You are looking at the correct file. 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]
