On Monday 17 November 2008 07:55:13 pm Roger Lovelock wrote:
> I suspect that I don't understand the naming conventions in bizObj! Below
> is my code :-
>
> def createBizobjs(self):
> class MembershiptypesBizobj(dabo.biz.dBizobj):
>
> def afterInit(self):
> self.DataSource = "MembershipTypes"
> self.KeyField = "MTypeID"
> self.addFrom("MembershipTypes")
> self.addField("MTypeDues")
> self.addField("MTypeDesc")
> self.addField("MTypeID")
>
> def validateRecord(self):
> """Returning anything other than an empty string from
> this method will prevent the data from being saved.
> """
> ret = ""
> if len(self.MTypeDesc) < 1:
> ret = "Must enter a description"
> # Add your business rules here.
> return ret
>
> membershipTypesBizobj = MembershiptypesBizobj(self.Connection)
> self.addBizobj(membershipTypesBizobj)
> self.requery()
>
> I'm missing something obvious here I think - as I just get the message :-
> AttributeError: /MembershiptypeBizobj' object has no attribute
> 'MTypeDesc'
>
> Can anyone please put me straight? Thanks
> Rodgy
>
> --- StripMime Report -- processed MIME parts ---
> multipart/alternative
> text/plain (text body -- kept)
> text/html
I believe you want
if len(self.getFieldVal("MTypeDec") < 1
and maybe it should be
myval=self.getFieldVal("MTypeDec")
if myval is None or len(myval) <1
--
John Fabiani
_______________________________________________
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]