Here is a doozy. I included my current bizobj code below. When it
runs, validate record is fired and everything is good. However, I am
getting some weird behavior when:
I uncomment the DefaultValues line
Existing records call validateRecord fine
I call the new method on the bizobj and try to save the new record
validateRecord never is called on save
If I comment the line out again and run my app, the validateRecord
method fires for both new and existing records.
class PartsBizobj(dBizobj):
def afterInit(self):
self.addFrom("Parts")
self.addField("ID")
self.addField("Code")
self.addField("DateAvailable")
self.DataSource = "Parts"
# self.DefaultValues = {"DateAvailable": datetime.date.today}
self.KeyField = "ID"
self.NonUpdateFields = ["ID"]
def validateRecord(self):
errorMessage = ""
code = self.getFieldVal("Code")
if not len(code):
errorMessage += "Code: Part Code may not be blank.\n"
elif len(code) > 10:
errorMessage += "Code: Part Code must be no more than 10
characters.\n"
return errorMessage
Regards,
Nate
_______________________________________________
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]