On Saturday, January 22, 2011 02:19:16 am David Martinez wrote:
> In my biz folder, I have two files that were automatically created by
> the ClassDesigner:
> 
> PubliccustomerBizobj.py
> PublichistoryBizobj.py
> 
> In my biz folder, my __init__.py file contains the following:
> 
> 
> from PubliccustomerBizobj import PubliccustomerBizobj
> from PublichistoryBizobj import PublichistoryBizobj
> 
> 
> 
> My customer class looks like this:
> 
> class PubliccustomerBizobj(dabo.biz.dBizobj):
>      def afterInit(self):
>          self.DataSource = "public.customer"
>          self.KeyField = "id"
>          self.addFrom("public.customer")
>          self.addField("cu_fax")
>          self.addField("cu_postal")
>          self.addField("cu_phone_2")
>          self.addField("cu_providence")
>          self.addField("cu_phone_1")
>          self.addField("cu_active")
>          self.addField("cu_country")
>          self.addField("cu_city")
>          self.addField("cu_rate")
>          self.addField("cu_name")
>          self.addField("cu_comments")
>          self.addField("cu_primary_contact_id")
>          self.addField("cu_address_1")
>          self.addField("cu_address_2")
>          self.addField("cu_address_3")
>          self.addField("id")
> 
>      def validateRecord(self):
>          """Returning anything other than an empty string from
>          this method will prevent the data from being saved.
>          """
>          ret = ""
>          # Add your business rules here.
>          return ret
> 
> 
> PubliccustomerBizobj.addChild(PublichistoryBizobj)
> 
> 
> 
> 
> My history class looks like this:
> 
> class PublichistoryBizobj(dabo.biz.dBizobj):
>      def afterInit(self):
>          self.DataSource = "public.history"
>          self.KeyField = "id"
>          self.LinkField = "hs_customer_id"
>          self.addFrom("public.history")
>          self.addField("hs_subject")
>          self.addField("hs_type")
>          self.addField("hs_datetime")
>          self.addField("hs_comments")
>          self.addField("id")
> 
>      def validateRecord(self):
>          """Returning anything other than an empty string from
>          this method will prevent the data from being saved.
>          """
>          ret = ""
>          # Add your business rules here.
>          return ret
> 
> 
> 
> However, when I try to run the application, the error I receive is this:
> 
> NameError: name 'PublichistoryBizobj' is not defined.
> 
> 
> 
> This error  references the
> "PubliccustomerBizobj.addChild(PublichistoryBizobj)" line. Why is this
> occurring?

Not sure but it appears that you are missing the self.ParentLinkField for the 
child bizobj.
self.ParentLinkField = 'id'

Johnf
_______________________________________________
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