Changeset 264

Show
Ignore:
Timestamp:
05/11/04 20:22:58 (5 years ago)
Author:
paul
Message:

The user can use bizobj.validateRecord() in a couple ways:

1) return errorMessageText, and dBizobj will raise the exception
2) raise the exception itself.

In case #2, None is returned, resulting in an exception in dBizobj.
This code fixes that.

If a user were to requery, and then answer yes to save changes, but
the save failed, the requery would happen anyway, wiping out all
their changes. This code fixes that.

There are still some funky problems though. Do this:

1) add a new record and save
2) add a new record and make the bizrule fail.

Note that the bizrule error text is listed twice, and that the browse
screen has reverted the original successfully-saved record back to the
value it had when it was new.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/biz/dBizobj.py

    r254 r264  
    480480            if self.isChanged(): 
    481481                # No need to validate if the data hasn't changed 
    482                 errMsg += self.validateRecord() 
     482                message = self.validateRecord() 
     483                if message: 
     484                    errMsg += self.validateRecord() 
    483485        self._moveToRowNum(currRow) 
    484486                 
  • trunk/ui/uiwx/classes/dForm.py

    r262 r264  
    211211            self.setStatusText(_("Save failed.")) 
    212212            dMessageBox.stop("%s:\n\n%s" % (_("Save Failed:"), _(str(e)))) 
    213  
    214  
     213            return False 
     214 
     215             
    215216    def cancel(self, dataSource=None): 
    216217        """ Ask the bizobj to cancel its changes. 
     
    259260                return 
    260261            elif response == True:  # yes 
    261                 self.save(dataSource=dataSource) 
     262                if not self.save(dataSource=dataSource): 
     263                    # The save failed, so don't continue with the requery 
     264                    return 
    262265 
    263266        self.setStatusText(_("Please wait... requerying dataset..."))