Changeset 5965

Show
Ignore:
Timestamp:
08/31/2010 06:01:52 AM (1 year ago)
Author:
ed
Message:

Added some logic to prevent infinite loops when using field-level validation.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/ui/uiwx/dForm.py

    r5958 r5965  
    5656        # Holds the dataSource passed to the method 
    5757        self.dataSourceParameter = None 
     58        # Flag to prevent infinite loops when doing field-level validation 
     59        self._fieldValidationControl = None 
    5860 
    5961 
     
    775777        can then respond to this. 
    776778        """ 
     779        if self._fieldValidationControl: 
     780            # Prevent infinite loops 
     781            return 
    777782        ds = ctrl.DataSource 
    778783        df = ctrl.DataField 
     
    810815        self.StatusText = _(u"Validation failed for %(df)s: %(err)s") % locals() 
    811816        dabo.ui.callAfter(ctrl.setFocus) 
     817        self._fieldValidationControl = ctrl 
     818 
     819 
     820    def _controlGotFocus(self, ctrl): 
     821        if self._fieldValidationControl is ctrl: 
     822            # Clear it 
     823            self._fieldValidationControl = None 
    812824         
    813825     
  • trunk/dabo/ui/uiwx/dPemMixin.py

    r5958 r5965  
    555555         
    556556    def __onWxGotFocus(self, evt): 
     557        self.Form._controlGotFocus(self) 
    557558        self._pushStatusText() 
    558559        if isinstance(self, dabo.ui.dGrid):