Thought I'd go back to basics! On the assumption that my problems arise
because I did not follow the Step-byStep guide exactly, but got the
ClassDesigner to create the Bizobj, which was therefore placed in the ui
code I did the following :-
cut and pasted the Bizobj class into the biz folder - code below :-
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import dabo
class MembershiptypesBizobj(dabo.biz.dBizobj):
def initProperties(self):
self.super()
self.Caption = "Membershiptypes"
self.DataSource = "MembershipTypes"
self.KeyField = "MTypeID"
self.DataStructure = (
("MTypeID", "I", True, "MembershipTypes", "MTypeID"),
("MTypeDesc", "C", False, "MembershipTypes", "MTypeDesc"),
("MTypeDues", "N", False, "MembershipTypes", "MTypeDues"),
)
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 = ""
myval = self.Record.MTypeDesc
if myval is None or myval =='':
ret = "Please enter a description"
# Add your business rules here.
return ret
def validateField(self, fld, val):
ret = ""
if fld == "MTypeDesc":
if val is None or val =='':
ret = "Please enter a description"
# Add your business rules here.
return ret
Then I changed the createBizobjs code to the following :-
def createBizobjs(self):
conn = self.Application.getConnectionByName("LodgeBooks")
membershiptypesBizobj = self.Application.biz.MembershiptypesBizobj(conn)
self.addBizobj(membershiptypesBizobj)
self.requery()
This was an attempt to get back to the way the Step-byStep guide shows the
example.
My theory is that by having the code in the ui folder a data initialisation
step is being omitted until such time as some data navigation occurs - this
data initialisation hopefully would occur automatically if the Bizobj is in
the biz folder (that was my theory). Unfortunately - no - even with all
these changes I am still seeing exactly the same behaviour as before!
Rodgy
----- Original Message -----
From: "Ed Leafe" <[EMAIL PROTECTED]>
To: "Dabo Users list" <[email protected]>
Sent: Saturday, November 22, 2008 8:14 AM
Subject: Re: [dabo-users] Bizobj Validation
> On Nov 21, 2008, at 3:09 PM, Roger Lovelock wrote:
>
>> Changed the self.requery() in afterInitAll to form.requery() - I
>> now get no
>> data on the form and when I try to navigate I get the status bar
>> message 'No
>> records in dataset'.
>
>
> Did you leave the bizobj creation in the createBizobjs() method, as
> well as the line that calls self.addBizobj()?
>
>
> -- Ed Leafe
>
>
>
>
>
[excessive quoting removed by server]
_______________________________________________
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]