There's a beforeDelete() at the form level, and one at the bizobj level. Each
are
called in the respective delete() methods of form and bizobj.
When the user chooses to delete a record, the form's delete() first checks the
return
value of form.beforeDelete(). If nothing returned, it calls biz.delete(). If
that
fails, the form displays the error message returned.
This seems sane. However, I like to keep almost all my code in the
bizobj-layer, not
the form layer, and so I code my beforeDelete() rules at the bizobj layer. If I
forget to make a binding like:
(in my form)
def beforeDelete(self):
return self.getBizobj().beforeDelete()
then my user ends up having to answer 'yes' to the dForm's default "are you
sure you
want to delete?" only to have it fail with the bizobj's beforeDelete() message.
I'm tempted to make a patch to dForm.delete() that also checks the return value
of
the bizobj's beforeDelete() method, and fails immediately if something is
returned.
But, I wanted to run it by Ed first, in case it violates the
chain-of-responsibility
design in some way.
Paul
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[email protected]