commit-gnue
[Top][All Lists]
Advanced

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

gnue-appserver/src geasInstance.py


From: Reinhard Mueller
Subject: gnue-appserver/src geasInstance.py
Date: Wed, 10 Sep 2003 15:31:43 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue-appserver
Branch:         
Changes by:     Reinhard Mueller <address@hidden>       03/09/10 15:31:42

Modified files:
        src            : geasInstance.py 

Log message:
        For numeric properties, return an integer for integer values and a 
float for
        non-integer values.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-appserver/src/geasInstance.py.diff?tr1=1.17&tr2=1.18&r1=text&r2=text

Patches:
Index: gnue-appserver/src/geasInstance.py
diff -c gnue-appserver/src/geasInstance.py:1.17 
gnue-appserver/src/geasInstance.py:1.18
*** gnue-appserver/src/geasInstance.py:1.17     Sat Sep  6 08:07:43 2003
--- gnue-appserver/src/geasInstance.py  Wed Sep 10 15:31:42 2003
***************
*** 19,25 ****
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # $Id: geasInstance.py,v 1.17 2003/09/06 12:07:43 siesel Exp $
  
  # 
=============================================================================
  # Instance class
--- 19,25 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # $Id: geasInstance.py,v 1.18 2003/09/10 19:31:42 reinhard Exp $
  
  # 
=============================================================================
  # Instance class
***************
*** 40,54 ****
    # Get the value of a property
    # 
---------------------------------------------------------------------------
  
!   def _get (self, propertyname):
      propertydef = self._classdef.properties [propertyname]
      if propertydef.gnue_type == "id" or \
         propertydef.gnue_type == "string":
!       # Basic property
        return self._record.getField (propertydef.column)
      elif propertydef.gnue_type == "number":
!       return int(self._record.getField (propertydef.column))
!       # TODO: add support for real
        
      elif self._classdef.classes.has_key (propertydef.gnue_type):
        # Reference property: gnue_type is a classname
--- 40,61 ----
    # Get the value of a property
    # 
---------------------------------------------------------------------------
  
!   def _getValue (self, propertyname):
      propertydef = self._classdef.properties [propertyname]
+ 
      if propertydef.gnue_type == "id" or \
         propertydef.gnue_type == "string":
!       # String property (the id is actually a string, too)
        return self._record.getField (propertydef.column)
+ 
      elif propertydef.gnue_type == "number":
!       # Number property
!       if propertydef.gnue_scale == 0:
!         # ... without fractional part
!         return int (self._record.getField (propertydef.column))
!       else:
!         # ... with fractional part
!         return float (self._record.getField (propertydef.column))
        
      elif self._classdef.classes.has_key (propertydef.gnue_type):
        # Reference property: gnue_type is a classname
***************
*** 68,74 ****
    def get (self, propertylist):
      result = []
      for property in propertylist:
!       value = self._get (property)
        # transfer None as ""
        if value == None:
          value = ""
--- 75,81 ----
    def get (self, propertylist):
      result = []
      for property in propertylist:
!       value = self._getValue (property)
        # transfer None as ""
        if value == None:
          value = ""
***************
*** 79,85 ****
    # Set the value of a property
    # 
---------------------------------------------------------------------------
  
!   def _put (self, propertyname, value):
      propertydef = self._classdef.properties [propertyname]
      # TODO: from property type, check if the new value is valid
      self._record.setField (propertydef.column, value)
--- 86,92 ----
    # Set the value of a property
    # 
---------------------------------------------------------------------------
  
!   def _putValue (self, propertyname, value):
      propertydef = self._classdef.properties [propertyname]
      # TODO: from property type, check if the new value is valid
      self._record.setField (propertydef.column, value)
***************
*** 91,97 ****
    def put (self, propertylist, valuelist):
      i = 0
      for property in propertylist:
!       self._put (property, valuelist [i])
        i += 1
  
    # 
---------------------------------------------------------------------------
--- 98,104 ----
    def put (self, propertylist, valuelist):
      i = 0
      for property in propertylist:
!       self._putValue (property, valuelist [i])
        i += 1
  
    # 
---------------------------------------------------------------------------




reply via email to

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