commit-gnue
[Top][All Lists]
Advanced

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

gnue-appserver/src geasList.py geasInstance.py


From: Jan Ischebeck
Subject: gnue-appserver/src geasList.py geasInstance.py
Date: Tue, 07 Oct 2003 12:03:54 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue-appserver
Branch:         
Changes by:     Jan Ischebeck <address@hidden>  03/10/07 12:03:54

Modified files:
        src            : geasList.py geasInstance.py 

Log message:
        Make appserver a bit more unicode aware (should fix german umlauts too)
        - connect to database in unicode mode
        - encode/decode string data from/to unicode (db side)
        to/from utf-8 (appserver side)

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-appserver/src/geasList.py.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-appserver/src/geasInstance.py.diff?tr1=1.19&tr2=1.20&r1=text&r2=text

Patches:
Index: gnue-appserver/src/geasInstance.py
diff -c gnue-appserver/src/geasInstance.py:1.19 
gnue-appserver/src/geasInstance.py:1.20
*** gnue-appserver/src/geasInstance.py:1.19     Wed Sep 10 16:31:39 2003
--- gnue-appserver/src/geasInstance.py  Tue Oct  7 12:03:53 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.19 2003/09/10 20:31:39 reinhard Exp $
  
  # 
=============================================================================
  # Instance class
--- 19,27 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # $Id: geasInstance.py,v 1.20 2003/10/07 16:03:53 siesel Exp $
! 
! import types
  
  # 
=============================================================================
  # Instance class
***************
*** 44,52 ****
      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
--- 46,61 ----
      propertydef = self._classdef.properties [propertyname]
  
      if propertydef.gnue_type == "id" or \
!        propertydef.gnue_type == "string":      
        # String property (the id is actually a string, too)
!       value = self._record.getField (propertydef.column)
!       try:
!         # encode unicode values to utf-8 (normal case)
!         return value.encode('utf-8')
!       except:
!         # if not UnicodeType then return normal string
!         return str(value)
!     
  
      elif propertydef.gnue_type == "number":
        # Number property
***************
*** 99,105 ****
  
    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)
  
    # 
---------------------------------------------------------------------------
--- 108,131 ----
  
    def _putValue (self, propertyname, value):
      propertydef = self._classdef.properties [propertyname]
! 
!     # 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)
!       try:
!         # decode unicode values from utf-8 
!         value = value.decode('utf-8')
!       except:
!         # return normal string in all other cases (this will raise a warning 
by
!         # the dbdriver
!         value = str(value)
!           
!     elif propertydef.gnue_type == "number":
!       # TODO: check if value is an number
!       pass
!       
      self._record.setField (propertydef.column, value)
  
    # 
---------------------------------------------------------------------------
Index: gnue-appserver/src/geasList.py
diff -c gnue-appserver/src/geasList.py:1.30 gnue-appserver/src/geasList.py:1.31
*** gnue-appserver/src/geasList.py:1.30 Wed Sep 10 16:31:39 2003
--- gnue-appserver/src/geasList.py      Tue Oct  7 12:03:53 2003
***************
*** 19,25 ****
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # $Id: geasList.py,v 1.30 2003/09/10 20:31:39 reinhard Exp $
  
  from gnue.common.datasources import GDataSource, GConditions
  import geasInstance
--- 19,25 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # $Id: geasList.py,v 1.31 2003/10/07 16:03:53 siesel Exp $
  
  from gnue.common.datasources import GDataSource, GConditions
  import geasInstance
***************
*** 59,64 ****
--- 59,65 ----
      attributes ["name"]     = ""
      attributes ["database"] = self._session.database
      attributes ["table"]    = self._classdef.table
+ 
      if self._sortColumns != []:
        attributes ["order_by"] = string.joinfields (self._sortColumns, ",")
  
***************
*** 68,73 ****
--- 69,77 ----
        attributes = attributes,
        fields = self._prefColumns)
  
+     # enable unicode mode for the datasource
+     self._datasource._dataObject._unicodeMode=1
+ 
    # 
---------------------------------------------------------------------------
    # Populate the list with data from the database backend
    # 
---------------------------------------------------------------------------
***************
*** 79,85 ****
  
    def populate (self, conditions):
      # TODO: translate property names to column names in conditions
!     # now building GCondition tree
      conditionTree = GConditions.buildTreeFromPrefix (conditions)
      self._resultset = self._datasource.createResultSet (conditionTree)
  
--- 83,89 ----
  
    def populate (self, conditions):
      # TODO: translate property names to column names in conditions
!     # now building GCondition tree    
      conditionTree = GConditions.buildTreeFromPrefix (conditions)
      self._resultset = self._datasource.createResultSet (conditionTree)
  




reply via email to

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