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: Sat, 18 Oct 2003 17:32:33 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue-appserver
Branch:         
Changes by:     Reinhard Mueller <address@hidden>       03/10/18 17:32:32

Modified files:
        src            : geasInstance.py 

Log message:
        Translate an empty string to None for all property types. This fixes 
changing
        numeric fields and date fields to NULL.

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

Patches:
Index: gnue-appserver/src/geasInstance.py
diff -c gnue-appserver/src/geasInstance.py:1.26 
gnue-appserver/src/geasInstance.py:1.27
*** gnue-appserver/src/geasInstance.py:1.26     Sat Oct 18 17:20:14 2003
--- gnue-appserver/src/geasInstance.py  Sat Oct 18 17:32:32 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.26 2003/10/18 21:20:14 reinhard Exp $
  
  import types
  from mx import DateTime
--- 19,25 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # $Id: geasInstance.py,v 1.27 2003/10/18 21:32:32 reinhard Exp $
  
  import types
  from mx import DateTime
***************
*** 181,196 ****
  
      # TODO: from property type: add more tests to see if the new value is 
valid
  
!     if propertydef.gnue_type == "id" or \
         propertydef.gnue_type == "string":      
        # String property (the id is actually a string, too)
!       if value == "":
!         value = None
!       else:
!         if type (value) is not types.StringType:
!           value = str (value)
!         # decode unicode values from utf-8 
!         value = unicode (value, 'utf-8')
            
      elif propertydef.gnue_type == "number":
        # TODO: check if value is an number
--- 181,195 ----
  
      # TODO: from property type: add more tests to see if the new value is 
valid
  
!     if value == "":
!       value = None
!     elif propertydef.gnue_type == "id" or \
         propertydef.gnue_type == "string":      
        # String property (the id is actually a string, too)
!       if type (value) is not types.StringType:
!         value = str (value)
!       # decode unicode values from utf-8 
!       value = unicode (value, 'utf-8')
            
      elif propertydef.gnue_type == "number":
        # TODO: check if value is an number
***************
*** 207,215 ****
  
      elif propertydef.gnue_type == "boolean":
        # Boolean property
!       if value == "":
!         value = None
!       elif value in [0, "0", "f", "F", "false", "FALSE", "n", "N", "no", 
"NO"]:
          value = 0
        elif value in [1, "1", "t", "T", "true", "true", "y", "Y", "yes", 
"YES"]:
          value = 1
--- 206,212 ----
  
      elif propertydef.gnue_type == "boolean":
        # Boolean property
!       if value in [0, "0", "f", "F", "false", "FALSE", "n", "N", "no", "NO"]:
          value = 0
        elif value in [1, "1", "t", "T", "true", "true", "y", "Y", "yes", 
"YES"]:
          value = 1




reply via email to

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