On Saturday 27 January 2007 07:55, Paul McNett wrote:
> johnf wrote:
> > In Dabo I don't know how to sub-class
> > the BizObj and have access to my class within Dabo.
>
> "within Dabo": You wouldn't have access to your class from within Dabo,
> because it wouldn't be part of Dabo.
>
> To subclass dBizobj you just:
>
> #-- begin sample
> import dabo
>
> class MyBiz(dabo.biz.dBizobj):
>       def initProperties(self):
>               # set things like the the keyfield, table name, etc.
>       def mySpecialFunction(self):
>               # do stuff
> #-- end sample
>
> So then you save it somewhere within your application directory
> structure as MyBiz.py, and when you want to instantiate it you:
>
> #-- begin sample
> import dabo
> import MyBiz
> conn = dabo.db.dConnection(User="blah"...)
> biz = MyBiz.MyBiz(conn)
> #-- end sample
Perfect.  That is what is happening in ClassDesigner when you add from the 
data environment (QuickLayoutWizard is run) and it creates:
def createBizobjs(self): 
class ArcustBizobj(dabo.biz.dBizobj):
                def afterInit(self):
                        self.DataSource = "public.arcust"
                        #self.UserSQL="Select * from public.arcust where custno 
like 'BRS'"
                        self.KeyField = "pkid"
                        self.addFrom("public.arcust")
                        self.addField("arcust.city")
                        self.addField("arcust.fax").....

arcustBizobj = ArcustBizobj(self.Connection)
self.addBizobj(arcustBizobj)

So now I have to figure out to call my special methods (in my BizObj) to 
provide the special handling of postgres datatypes when doing an Update.  Of 
course I'm looking for a hint here because I'm really fuzzy as how to:  
How to control the update statement that is needed.  Do I sub-class 
the "_sqlMgrCursor"?  Would I provide my own "Form.new", "Form.save" which 
would call my special BizObj methods?  As you can see I again don't have an 
idea of what I speak - but I'm learning very fast.  

BTW speaking of learning I have realized that I'm learning by doing and not 
reading.  I don't believe I have done that in the past.  What is surprising 
is what I'm able to produce - my forms are working.
-- 
John Fabiani

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Reply via email to