commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue common/src/dbdrivers/_dbsig/DBdriver.py fo...


From: Jan Ischebeck
Subject: gnue common/src/dbdrivers/_dbsig/DBdriver.py fo...
Date: Fri, 25 Oct 2002 21:13:20 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     Jan Ischebeck <address@hidden>  02/10/25 21:13:19

Modified files:
        common/src/dbdrivers/_dbsig: DBdriver.py 
        forms/src/GFObjects: GFParameter.py 
        forms/src      : GFForm.py 
Added files:
        samples/testcases/trigger: refresh_dropdown.gfd 

Log message:
        add an testcase for dropdown refreshs
        remove dbsig modifying GObj tree and parameter caching
        add setParameter function

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/samples/testcases/trigger/refresh_dropdown.gfd?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/dbdrivers/_dbsig/DBdriver.py.diff?tr1=1.55&tr2=1.56&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFObjects/GFParameter.py.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFForm.py.diff?tr1=1.188&tr2=1.189&r1=text&r2=text

Patches:
Index: gnue/common/src/dbdrivers/_dbsig/DBdriver.py
diff -c gnue/common/src/dbdrivers/_dbsig/DBdriver.py:1.55 
gnue/common/src/dbdrivers/_dbsig/DBdriver.py:1.56
*** gnue/common/src/dbdrivers/_dbsig/DBdriver.py:1.55   Thu Oct  3 10:35:48 2002
--- gnue/common/src/dbdrivers/_dbsig/DBdriver.py        Fri Oct 25 21:13:19 2002
***************
*** 361,387 ****
            return self._toSqlString(element.value)
        elif otype == 'cparam':
          v = element.getValue()
!         return (v == None and "NULL") or ("'%s'" % element.getValue())
        elif self.conditionElements.has_key(otype):
          for i in range(0, len(element._children)):
!           element._children[i] = self.__conditionToSQL(element._children[i])
!         if len(element._children) == 2 and \
             otype in ('eq','ne') and \
!            element._children[1] == 'NULL':
             otype = "__is%s" % otype
!         if len(element._children) < self.conditionElements[otype][0]:
            raise GConditions.ConditionError, \
              _('Condition element "%s" expects at least %s arguments; found 
%s') % \
!                 (otype, self.conditionElements[otype][0], 
len(element._children))
!         if len(element._children) > self.conditionElements[otype][1]:
            raise GConditions.ConditionError, \
              _('Condition element "%s" expects at most %s arguments; found 
%s') % \
!                 (otype, self.conditionElements[otype][0], 
len(element._children))
          if self.conditionElements[otype][3] == None:
!           return self.conditionElements[otype][2] % tuple(element._children)
          else:
            return self.conditionElements[otype][2] % \
!             (string.join(element._children, self.conditionElements[otype][3]))
        else:
          raise GConditions.ConditionNotSupported, \
            _('Condition clause "%s" is not supported by this db driver.') % 
otype
--- 361,389 ----
            return self._toSqlString(element.value)
        elif otype == 'cparam':
          v = element.getValue()
!         return (v == None and "NULL") or ("'%s'" % v)
        elif self.conditionElements.has_key(otype):
+         result=[]
          for i in range(0, len(element._children)):
!           result.append(self.__conditionToSQL(element._children[i]))
!         if len(result) == 2 and \
             otype in ('eq','ne') and \
!            result[1] == 'NULL':
             otype = "__is%s" % otype
!         if len(result) < self.conditionElements[otype][0]:
            raise GConditions.ConditionError, \
              _('Condition element "%s" expects at least %s arguments; found 
%s') % \
!                 (otype, self.conditionElements[otype][0], len(result))
!         if len(result) > self.conditionElements[otype][1]:
            raise GConditions.ConditionError, \
              _('Condition element "%s" expects at most %s arguments; found 
%s') % \
!                 (otype, self.conditionElements[otype][0], len(result))
! 
          if self.conditionElements[otype][3] == None:
!           return self.conditionElements[otype][2] % tuple(result)
          else:
            return self.conditionElements[otype][2] % \
!             (string.join(result, self.conditionElements[otype][3]))
        else:
          raise GConditions.ConditionNotSupported, \
            _('Condition clause "%s" is not supported by this db driver.') % 
otype
Index: gnue/forms/src/GFForm.py
diff -c gnue/forms/src/GFForm.py:1.188 gnue/forms/src/GFForm.py:1.189
*** gnue/forms/src/GFForm.py:1.188      Thu Oct 24 00:39:02 2002
--- gnue/forms/src/GFForm.py    Fri Oct 25 21:13:19 2002
***************
*** 95,100 ****
--- 95,103 ----
                                'getParameter':{'function':self.getParameter,
                                            'global': 1,
                                            },
+                               'setParameter':{'function':self.setParameter,
+                                           'global': 1,
+                                           },
                                'showMessage':{'function':self.showMessageBox,
                                            'global': 1,
                                            },
***************
*** 181,186 ****
--- 184,196 ----
            self._parameters[param] = rv
            break
      return rv
+ 
+   #
+   # Set a user parameter.
+   #
+   def setParameter(self, parameter, value):
+     param = string.lower(parameter)
+     self._parameters[param]=value
  
  
    #
Index: gnue/forms/src/GFObjects/GFParameter.py
diff -c gnue/forms/src/GFObjects/GFParameter.py:1.5 
gnue/forms/src/GFObjects/GFParameter.py:1.6
*** gnue/forms/src/GFObjects/GFParameter.py:1.5 Mon Sep 23 13:32:10 2002
--- gnue/forms/src/GFObjects/GFParameter.py     Fri Oct 25 21:13:19 2002
***************
*** 65,81 ****
  
  
    def getValue(self):
-     try:
-       return self._cachedValue
-     except:
        val = self._form.getParameter(self._name)
- 
        if val is None:
!         self._cachedValue = ""
        elif self._parameter.type == 'number':
!         self._cachedValue = float(val)
        else:
!         self._cachedValue = "%s" % val
! 
!       return self._cachedValue
  
--- 65,75 ----
  
  
    def getValue(self):
        val = self._form.getParameter(self._name)
        if val is None:
!         return ""
        elif self._parameter.type == 'number':
!         return float(val)
        else:
!         return "%s" % val
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]