commit-gnue
[Top][All Lists]
Advanced

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

r5289 - in trunk/gnue-appserver/src: . classrep


From: reinhard
Subject: r5289 - in trunk/gnue-appserver/src: . classrep
Date: Wed, 10 Mar 2004 11:11:21 -0600 (CST)

Author: reinhard
Date: 2004-03-10 11:11:20 -0600 (Wed, 10 Mar 2004)
New Revision: 5289

Modified:
   trunk/gnue-appserver/src/classrep/Base.py
   trunk/gnue-appserver/src/classrep/Definition.py
   trunk/gnue-appserver/src/classrep/SchemaSupport.py
   trunk/gnue-appserver/src/data.py
   trunk/gnue-appserver/src/geasInstance.py
   trunk/gnue-appserver/src/geasSession.py
   trunk/gnue-appserver/src/geasSessionManager.py
Log:
Use unicode strings everywhere.


Modified: trunk/gnue-appserver/src/classrep/Base.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Base.py   2004-03-10 15:27:31 UTC (rev 
5288)
+++ trunk/gnue-appserver/src/classrep/Base.py   2004-03-10 17:11:20 UTC (rev 
5289)
@@ -174,20 +174,11 @@
   # ---------------------------------------------------------------------------
   def __getattr__ (self, attr):
     if self.__predefined.has_key (attr):
-      return self.__getValue (self.__predefined [attr])
+      return self.__predefined [attr]
     else:
-      return self.__getValue (getattr (self.__getObject (), attr))
+      return getattr (self.__getObject (), attr)
 
   # ---------------------------------------------------------------------------
-  # Make sure unicode-type values will be encoded as utf-8
-  # ---------------------------------------------------------------------------
-  def __getValue (self, value):
-    if isinstance (value, types.UnicodeType):
-      return value.encode ('utf-8')
-    else:
-      return value
-
-  # ---------------------------------------------------------------------------
   # Get a language interface object
   # ---------------------------------------------------------------------------
   def __getObject (self):

Modified: trunk/gnue-appserver/src/classrep/Definition.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Definition.py     2004-03-10 15:27:31 UTC 
(rev 5288)
+++ trunk/gnue-appserver/src/classrep/Definition.py     2004-03-10 17:11:20 UTC 
(rev 5289)
@@ -59,9 +59,10 @@
     for section in self.parser.sections ():
       data = {}
       for option in self.parser.options (section):
-       data [string.lower (option)] = self.parser.get (section, option)
+       u = unicode (self.parser.get (section, option))
+       data [string.lower (option)] = u
 
-      identifier = string.lower (section)
+      identifier = unicode (string.lower (section))
       nsid = getNamespaceId (identifier)
 
       if nsid == NSID_MODULE:

Modified: trunk/gnue-appserver/src/classrep/SchemaSupport.py
===================================================================
--- trunk/gnue-appserver/src/classrep/SchemaSupport.py  2004-03-10 15:27:31 UTC 
(rev 5288)
+++ trunk/gnue-appserver/src/classrep/SchemaSupport.py  2004-03-10 17:11:20 UTC 
(rev 5289)
@@ -140,7 +140,7 @@
   def __createTableDef (self, gsTables, classdef):
 
     table      = GSTable (gsTables)
-    table.name = unicode (classdef.table, "utf-8")
+    table.name = classdef.table
 
     # add fields listing (required)
     fields = GSFields (table)
@@ -149,9 +149,9 @@
 
     for cProp in classdef.properties.values ():
       field = GSField (fields)
-      field.name        = unicode (cProp.column, "utf-8")
-      field.description = unicode (cProp.gnue_comment, "utf-8")
-      field.type        = unicode (cProp.dbType, "utf-8")
+      field.name        = cProp.column
+      field.description = cProp.gnue_comment
+      field.type        = cProp.dbType
       field.precision   = int (cProp.dbScale)
       if int (cProp.dbLength) > 0:
         field.length = int (cProp.dbLength)
@@ -163,7 +163,7 @@
     if classdef.properties.has_key ("gnue_id"):
       if classdef.properties ["gnue_id"].gnue_type == "id":
         pk = GSPrimaryKey (table)
-        pk.name = "gnue_id_pk_%s" % unicode (classdef.table, "utf-8")
+        pk.name = "gnue_id_pk_%s" % classdef.table
 
         pkf = GSPKField (pk)
         pkf.name = 'gnue_id'
@@ -259,8 +259,7 @@
   def __buildValue (self, row, prop, data):
     value = GSValue (row)
     value.field = prop.column
-    GContent (value,
-      unicode (self.__nativeToString (data, prop.dbFullType), 'utf-8'))
+    GContent (value, self.__nativeToString (data, prop.dbFullType))
 
 
   # ---------------------------------------------------------------------------
@@ -285,26 +284,21 @@
 
   def __nativeToString (self, native, datatype):
     """
-    This function creates a string to be used in a <value>-tag of a GSD file.
-    The native python object will be treated and theirfore converted as
+    This function creates a unicode string to be used in a <value>-tag of a GSD
+    file.  The native python object will be treated and theirfore converted as
     'datatype'.
     """
     _LENGTH_SCALE = re.compile ('^\w+\s*\((\d+)[\.]{0,1}(\d*)\)\s*')
 
     if datatype [:6] == "string":
+      checktype (native, [NoneType, UnicodeType])
+
       if native is None:
-        return ""
+        return u''
 
       if isinstance (native, types.UnicodeType):
-        return native.encode ('utf-8')
-
-      elif isinstance (native, types.StringType):
         return native
 
-      else:
-        return str (native)
-
-
     elif datatype [:6] == "number":
       if native is None:
         return "0"
@@ -322,7 +316,7 @@
 
         vmatch = re.compile ('^([+-]{0,1})(\d+)[\.]{0,1}(\d*)$').match (res)
         if vmatch is None:
-          raise EInvalidValue (_("%s is not a valid number.") % repr (res))
+          raise EInvalidValue (_("%s is not a valid number.") % repr (native))
 
           sign = vmatch.groups () [0]
           pre  = vmatch.groups () [1]
@@ -331,16 +325,16 @@
           if len (pre) > (flength-fscale) or len (frac) > fscale:
             raise EInvalidValue (_(
 """%(value)s exceeds precision (%(length)d.%(scale)d)""") % \
-                  { "value": repr (res), "length": flength, "scale": fscale})
+                  { "value": repr (native), "length": flength, "scale": 
fscale})
 
       return res
 
 
     elif datatype == "boolean":
       if native is not None and native:
-        return "TRUE"
+        return u'TRUE'
       else:
-        return "FALSE"
+        return u'FALSE'
 
 
     elif datatype == "date":

Modified: trunk/gnue-appserver/src/data.py
===================================================================
--- trunk/gnue-appserver/src/data.py    2004-03-10 15:27:31 UTC (rev 5288)
+++ trunk/gnue-appserver/src/data.py    2004-03-10 17:11:20 UTC (rev 5289)
@@ -21,10 +21,13 @@
 #
 # $Id$
 
+from types import *
+
 import string
 import whrandom
-from gnue.common.datasources import GDataSource, GConditions
 
+from gnue.common.datasources import GDataSource, GConditions, GConnections
+
 # =============================================================================
 # Cache class
 # =============================================================================
@@ -66,6 +69,9 @@
     It is possible to set a dirty value without having set an original value
     before.
     """
+    checktype (table, UnicodeType)
+    checktype (row, UnicodeType)
+    checktype (field, UnicodeType)
 
     if dirty:
       tables = self.__new
@@ -113,6 +119,9 @@
     Return true (1) if the given item is stored in the cache (either in a clean
     or in a dirty version). Return false (0) if it isn't.
     """
+    checktype (table, UnicodeType)
+    checktype (row, UnicodeType)
+    checktype (field, UnicodeType)
 
     if self.__has (table, row, field, 1) or self.__has (table, row, field, 0):
       return 1
@@ -130,6 +139,9 @@
 
     If the given item isn't available, an exception is raised.
     """
+    checktype (table, UnicodeType)
+    checktype (row, UnicodeType)
+    checktype (field, UnicodeType)
 
     if self.__has (table, row, field, 1):
       tables = self.__new               # Data is in dirty cache
@@ -158,14 +170,16 @@
     be available for any record except for newly created ones, and setting
     'gnue_id' to None means deleting the record.
     """
+    checktype (table, UnicodeType)
+    checktype (row, UnicodeType)
 
-    if not self.__has (table, row, 'gnue_id', 0):
+    if not self.__has (table, row, u'gnue_id', 0):
       return ''                         # row is not in cache at all
 
-    old_id = self.__old [table] [row] ['gnue_id']
+    old_id = self.__old [table] [row] [u'gnue_id']
 
-    if self.__has (table, row, 'gnue_id', 1):
-      new_id = self.__new [table] [row] ['gnue_id']
+    if self.__has (table, row, u'gnue_id', 1):
+      new_id = self.__new [table] [row] [u'gnue_id']
     else:
       new_id = old_id
 
@@ -281,7 +295,7 @@
 
 def _find (connections, database, table, row, fields):
 
-  conditions = [['eq', ''], ['field', 'gnue_id'], ['const', row]]
+  conditions = [['eq', ''], ['field', u'gnue_id'], ['const', row]]
   resultSet = _createResultSet (connections, database, table, fields,
                                 conditions, [])
   resultSet.firstRecord ()
@@ -304,6 +318,9 @@
   # ---------------------------------------------------------------------------
 
   def __init__ (self, connections, database):
+    checktype (connections, GConnections.GConnections)
+    checktype (database, StringType)
+
     self.__connections = connections
     self.__database = database
     self.__cache = _cache ()
@@ -318,11 +335,14 @@
     the database and cached, so that subsequential access to those fields won't
     trigger another access to the db backend.
 
-    Table and field names must be strings.
+    Table and field names must be unicode strings.
 
     Field values in conditions must be in native Python type; in case of
     strings they must be Unicode.
     """
+    checktype (table, UnicodeType)
+    checktype (fields, ListType)
+    for fields_element in fields: checktype (fields_element, UnicodeType)
 
     return recordset (self.__cache, self.__connections, self.__database, table,
                       fields, conditions, order)
@@ -334,10 +354,10 @@
   def __generateId (self):
 
     # TODO: need a better algorithm here
-    result = ''
+    result = u''
     for i in range (0, 32):
       result = result + str (int (whrandom.random () * 10))
-    return unicode (result)
+    return result
 
   # ---------------------------------------------------------------------------
   # Create a new record
@@ -347,13 +367,14 @@
     """
     Inserts a new record. A 'gnue_id' is assigned automatically.
 
-    Table must be a string.
+    Table must be a unicode string.
     """
+    checktype (table, UnicodeType)
 
     id = self.__generateId ()
     r = record (self.__cache, self.__connections, self.__database, table, id)
-    self.__cache.write (table, id, 'gnue_id', None, 0)  # old id is None
-    self.__cache.write (table, id, 'gnue_id', id, 1)    # new id
+    self.__cache.write (table, id, u'gnue_id', None, 0)  # old id is None
+    self.__cache.write (table, id, u'gnue_id', id, 1)    # new id
     return r
 
   # ---------------------------------------------------------------------------
@@ -366,12 +387,14 @@
     data of the record will stay available until commit, but the field
     'gnue_id' will seem to have a value of None.
 
-    Table must be a string, row must be Unicode.
+    Table and row must be unicode strings.
     """
+    checktype (table, UnicodeType)
+    checktype (row, UnicodeType)
 
-    if not self.__cache.has (table, row, 'gnue_id'):    # not yet in cache
-      self.__cache.write (table, row, 'gnue_id', row, 0)
-    self.__cache.write (table, row, 'gnue_id', None, 1)
+    if not self.__cache.has (table, row, u'gnue_id'):    # not yet in cache
+      self.__cache.write (table, row, u'gnue_id', row, 0)
+    self.__cache.write (table, row, u'gnue_id', None, 1)
 
   # ---------------------------------------------------------------------------
   # Find a record
@@ -385,8 +408,13 @@
 
     This method won't query the db backend for data which is already cached.
 
-    Table and fields must be a string, row must be Unicode.
+    Table and row must be unicode strings, fields must be a list of unicode
+    strings.
     """
+    checktype (table, UnicodeType)
+    checktype (row, UnicodeType)
+    checktype (fields, ListType)
+    for fields_element in fields: checktype (fields_element, UnicodeType)
 
     uncachedFields = []
     for field in fields:
@@ -435,7 +463,7 @@
           # without reading it first. Until that is done, we have to create a
           # temporary resultSet for every record we update
           resultSet = _find (self.__connections, self.__database, table, row,
-                             ['gnue_id'] + fields.keys ())
+                             [u'gnue_id'] + fields.keys ())
 
           for (field, value) in fields.items ():
             resultSet.current.setField (field, value)
@@ -445,7 +473,7 @@
           # without reading it first. Until that is done, we have to create a
           # temporary resultSet for every record we delete
           resultSet = _find (self.__connections, self.__database, table, row,
-                             ['gnue_id'])
+                             [u'gnue_id'])
           resultSet.current.delete ()
 
         if status != '':
@@ -501,7 +529,7 @@
     self.__connections = connections
     self.__database = database
     self.__table = table
-    self.__fields = ['gnue_id'] + fields
+    self.__fields = [u'gnue_id'] + fields
     self.__resultSet = _createResultSet (self.__connections, self.__database,
                                          self.__table, self.__fields, 
                                          conditions, order)
@@ -526,7 +554,7 @@
     if self.__resultSet.firstRecord () is None:
       return None
     else:
-      id = self.__resultSet.current ['gnue_id']
+      id = self.__resultSet.current [u'gnue_id']
       r = record (self.__cache, self.__connections, self.__database,
                   self.__table, id)
       r._fill (self.__fields, self.__resultSet.current)
@@ -544,7 +572,7 @@
     if self.__resultSet.nextRecord () is None:
       return None
     else:
-      id = self.__resultSet.current ['gnue_id']
+      id = self.__resultSet.current [u'gnue_id']
       r = record (self.__cache, self.__connections, self.__database,
                   self.__table, id)
       r._fill (self.__fields, self.__resultSet.current)
@@ -594,9 +622,11 @@
     Get the value for a field. If the value isn't cached, a new query to the
     database is issued to get the value.
 
-    The field name must be given as a string. The result will be returned as
-    the native Python datatype, in case of a string field it will be Unicode.
+    The field name must be given as a unicode string. The result will be
+    returned as the native Python datatype, in case of a string field it will
+    be Unicode.
     """
+    checktype (field, UnicodeType)
 
     if self.__cache.has (self.__table, self.__row, field):
       # If we find the field in the cache, use it
@@ -620,9 +650,10 @@
     """
     Put the value for a field.
 
-    The field name must be given as a string, value must be the native Python
-    datatype of the field, in case of a string field it must be Unicode.
+    The field name must be given as a unicode string, value must be the native
+    Python datatype of the field, in case of a string field it must be Unicode.
     """
+    checktype (field, UnicodeType)
 
     self.__cache.write (self.__table, self.__row, field, value, 1)
 
@@ -641,7 +672,7 @@
   print 'Ok'
 
   print 'connection.query for existing records ...'
-  rs = c.query ('address_person', ['address_name'], None, ['address_name'])
+  rs = c.query (u'address_person', [u'address_name'], None, [u'address_name'])
   print 'Ok'
 
   print 'recordset.firstRecord ...',
@@ -649,40 +680,40 @@
   print 'Ok'
 
   print 'record.getField with prefetched data ...',
-  print repr (r.getField ('address_name'))
+  print repr (r.getField (u'address_name'))
 
   print 'record.getField with non-prefetched data ...',
-  print repr (r.getField ('address_city'))
+  print repr (r.getField (u'address_city'))
 
   print 'recordset.nextRecord ...',
   r = rs.nextRecord ()
   print 'Ok'
 
   print 'record.getField with prefetched data ...',
-  print repr (r.getField ('address_name'))
+  print repr (r.getField (u'address_name'))
 
   print 'connection.insertRecord ...',
-  r = c.insertRecord ('address_person')
+  r = c.insertRecord (u'address_person')
   print 'Ok'
 
   print 'record.getField ...',
-  id = r.getField ('gnue_id')
+  id = r.getField (u'gnue_id')
   print repr (id)
 
   print 'record.putField ...',
-  r.putField ('address_name', u'New Person')
+  r.putField (u'address_name', u'New Person')
   print 'Ok'
 
   print 'record.getField of inserted data ...',
-  print repr (r.getField ('address_name'))
+  print repr (r.getField (u'address_name'))
 
   print 'connection.commit with an inserted record ...',
   c.commit ()
   print 'Ok'
 
   print 'connection.query for previously inserted record ...',
-  rs = c.query ('address_person', ['address_name'],
-                [['eq', ''], ['field', 'address_name'],
+  rs = c.query (u'address_person', [u'address_name'],
+                [['eq', ''], ['field', u'address_name'],
                              ['const', u'New Person']], None)
   print 'Ok'
 
@@ -691,50 +722,51 @@
   print 'Ok'
 
   print 'record.getField with prefetched data ...',
-  print repr (r.getField ('address_name'))
+  print repr (r.getField (u'address_name'))
 
   print 'record.putField of prefetched data ...',
-  r.putField ('address_name', u'New Name')
+  r.putField (u'address_name', u'New Name')
   print 'Ok'
 
   print 'record.putField of non-prefetched data ...',
-  r.putField ('address_city', u'New City')
+  r.putField (u'address_city', u'New City')
   print 'Ok'
 
   print 'record.getField of changed data ...',
-  print repr (r.getField ('address_name'))
+  print repr (r.getField (u'address_name'))
 
   print 'connection.findRecord for previously changed record ...',
-  r = c.findRecord ('address_person', id, ['address_name'])
+  r = c.findRecord (u'address_person', id, [u'address_name'])
   print 'Ok'
 
   print 'record.getField of changed data, independent query ...',
-  print repr (r.getField ('address_city'))
+  print repr (r.getField (u'address_city'))
 
   print 'connection.commit with a changed record ...',
   c.commit ()
   print 'Ok'
 
   print 'record.getField of prefetched data ...',
-  print repr (r.getField ('address_name'))
+  print repr (r.getField (u'address_name'))
 
   print 'connection.deleteRecord ...',
-  c.deleteRecord ('address_person', id)
+  c.deleteRecord (u'address_person', id)
   print 'Ok'
 
   print 'record.getField of deleted uncommitted record, prefetched ...',
-  print repr (r.getField ('address_name'))
+  print repr (r.getField (u'address_name'))
 
   print 'record.getField of deleted uncommitted record, non-prefetched ...',
-  print repr (r.getField ('address_city'))
+  print repr (r.getField (u'address_city'))
 
   print 'connection.commit with a deleted record ...',
   c.commit ()
   print 'Ok'
 
   print 'check if the record is really gone now ...',
-  rs = c.query ('address_person', ['address_name'],
-                [['eq', ''], ['field', 'address_city'], ['const', u'New 
City']],
+  rs = c.query (u'address_person', [u'address_name'],
+                [['eq', ''], ['field', u'address_city'],
+                             ['const', u'New City']],
                 None)
   if rs.firstRecord () != None:
     raise Exception

Modified: trunk/gnue-appserver/src/geasInstance.py
===================================================================
--- trunk/gnue-appserver/src/geasInstance.py    2004-03-10 15:27:31 UTC (rev 
5288)
+++ trunk/gnue-appserver/src/geasInstance.py    2004-03-10 17:11:20 UTC (rev 
5289)
@@ -274,7 +274,7 @@
 
     # Create an object representing the current business object
     obj = Object.Object (sess, self.__classdef.fullName, 
-                         self._getValue ("gnue_id"))
+                         self._getValue (u'gnue_id'))
 
     # fetch the procedure definition
     proceduredef = self.__classdef.procedures [procedurename]

Modified: trunk/gnue-appserver/src/geasSession.py
===================================================================
--- trunk/gnue-appserver/src/geasSession.py     2004-03-10 15:27:31 UTC (rev 
5288)
+++ trunk/gnue-appserver/src/geasSession.py     2004-03-10 17:11:20 UTC (rev 
5289)
@@ -125,13 +125,13 @@
 
     # TODO: translate property names to column names in conditions
     sortlist = self.__getFieldlist (classdef, sortorder)
-    fieldlist = self.__getFieldlist (classdef, ['gnue_id'] + propertylist)
+    fieldlist = self.__getFieldlist (classdef, [u'gnue_id'] + propertylist)
 
     recordset = self.__connection.query (classdef.table, fieldlist, conditions,
                                          sortlist)
 
     list = geasList.geasList (self, classdef, recordset,
-                              ['gnue_id'] + propertylist)
+                              [u'gnue_id'] + propertylist)
 
     self.__listcount += 1
     self.__lists [self.__listcount] = list
@@ -222,7 +222,7 @@
         result.append (object_id)
       else:
         instance = self.__newInstance (classdef)
-        result.append (instance.get (['gnue_id']) [0])
+        result.append (instance.get ([u'gnue_id']) [0])
       instance.put (propertylist, data [i])
       i += 1
 

Modified: trunk/gnue-appserver/src/geasSessionManager.py
===================================================================
--- trunk/gnue-appserver/src/geasSessionManager.py      2004-03-10 15:27:31 UTC 
(rev 5288)
+++ trunk/gnue-appserver/src/geasSessionManager.py      2004-03-10 17:11:20 UTC 
(rev 5289)
@@ -21,6 +21,8 @@
 #
 # $Id$
 
+from types import *
+
 import geasSession
 import geasAuthentication
 import classrep
@@ -56,6 +58,35 @@
     self._langRuntimes = {} 
 
   # ---------------------------------------------------------------------------
+  # Convert a utf-8 string (from rpc interface) to unicode
+  # ---------------------------------------------------------------------------
+
+  def __uconvert (self, value):
+    # FIXME: This should be done in the RPC server adapter
+    if type (value) == ListType:
+      return [self.__uconvert (x) for x in value]
+    elif type (value) == StringType:
+      return unicode (value, 'utf-8')
+    elif type (value) == TupleType:
+      (x, y) = value
+      return (self.__uconvert (x), self.__uconvert (y))
+    else:
+      return value
+
+  # ---------------------------------------------------------------------------
+  # Convert a unicode string (from rpc interface) to utf-8
+  # ---------------------------------------------------------------------------
+
+  def __sconvert (self, value):
+    # FIXME: This should be done in the RPC server adapter
+    if type (value) == ListType:
+      return [self.__sconvert (x) for x in value]
+    elif type (value) == UnicodeType:
+      return value.encode ('utf-8')
+    else:
+      return value
+
+  # ---------------------------------------------------------------------------
   # Build an internal session
   # ---------------------------------------------------------------------------
 
@@ -75,9 +106,13 @@
     else:
       raise Exception, _("Can't find a session with ID '%s'") % sess_id
 
-  # ---------------------------------------------------------------------------
+  # ===========================================================================
   # official API functions
+  # ===========================================================================
+
   # ---------------------------------------------------------------------------
+  # Open the connection
+  # ---------------------------------------------------------------------------
 
   def open (self, authentication):
     # TODO use a better session ID than this one
@@ -98,6 +133,10 @@
     self._sessions [self._sessNo] = sess
     return self._sessNo
 
+  # ---------------------------------------------------------------------------
+  # Close the connection
+  # ---------------------------------------------------------------------------
+
   def close (self, session_id, commit):
     s = self._getSession (session_id)
     if commit:
@@ -105,39 +144,100 @@
     s.logout ()
     del self._sessions [session_id]
 
+  # ---------------------------------------------------------------------------
+  # Commit current transaction
+  # ---------------------------------------------------------------------------
+
   def commit (self, session_id):
     s = self._getSession (session_id)
     s.commit ()
 
+  # ---------------------------------------------------------------------------
+  # Rollback current transaction
+  # ---------------------------------------------------------------------------
+
   def rollback (self, session_id):
     s = self._getSession (session_id)
     s.rollback ()
 
+  # ---------------------------------------------------------------------------
+  # Build list from query
+  # ---------------------------------------------------------------------------
+
   def request (self, session_id, classname, conditions, sortorder,
                propertylist):
+    __classname = self.__uconvert (classname)
+    __conditions = self.__uconvert (conditions)
+    __sortorder = self.__uconvert (sortorder)
+    __propertylist = self.__uconvert (propertylist)
+
     s = self._getSession (session_id)
-    return s.request (classname, conditions, sortorder, propertylist)
+    return s.request (__classname, __conditions, __sortorder, __propertylist)
 
+  # ---------------------------------------------------------------------------
+  # Count number of objects in list
+  # ---------------------------------------------------------------------------
+
   def count (self, session_id, list_id):
     s = self._getSession (session_id)
     return s.count (list_id);
 
+  # ---------------------------------------------------------------------------
+  # Fetch objects from list
+  # ---------------------------------------------------------------------------
+
   def fetch (self, session_id, list_id, start, count, close=0):
     s = self._getSession (session_id)
     return s.fetch (list_id, start, count)
 
+  # ---------------------------------------------------------------------------
+  # Load objects from ids
+  # ---------------------------------------------------------------------------
+
   def load (self, session_id, classname, obj_id_list, propertylist):
+    __classname = self.__uconvert (classname)
+    __obj_id_list = self.__uconvert (obj_id_list)
+    __propertylist = self.__uconvert (propertylist)
+
     s = self._getSession (session_id)
-    return s.load (classname, obj_id_list, propertylist)
+    return self.__sconvert (s.load (__classname, __obj_id_list,
+                                    __propertylist))
 
+  # ---------------------------------------------------------------------------
+  # Store objects
+  # ---------------------------------------------------------------------------
+
   def store (self, session_id, classname, obj_id_list, propertylist, data):
+    __classname = self.__uconvert (classname)
+    __obj_id_list = self.__uconvert (obj_id_list)
+    __propertylist = self.__uconvert (propertylist)
+    # data is converted in geasInstance.putValue
+
     s = self._getSession (session_id)
-    return s.store (classname, obj_id_list, propertylist, data)
+    return self.__sconvert (s.store (__classname, __obj_id_list,
+                                     __propertylist, data))
 
+  # ---------------------------------------------------------------------------
+  # Delete objects
+  # ---------------------------------------------------------------------------
+
   def delete (self, session_id, classname, obj_id_list):
+    __classname = self.__uconvert (classname)
+    __obj_id_list = self.__uconvert (obj_id_list)
+
     s = self._getSession (session_id)
-    return s.delete (classname, obj_id_list)
+    s.delete (__classname, __obj_id_list)
 
-  def call (self, session_id, classname, obj_id_list, methodname, parameters):
+  # ---------------------------------------------------------------------------
+  # Call procedure
+  # ---------------------------------------------------------------------------
+
+  def call (self, session_id, classname, obj_id_list, procedurename,
+            parameters):
+    __classname = self.__uconvert (classname)
+    __obj_id_list = self.__uconvert (obj_id_list)
+    # FIXME: procedurename and parameters must be converted
+
     s = self._getSession (session_id)
-    return s.call (classname, obj_id_list, methodname, parameters)
+    return self.__sconvert (s.call (__classname, __obj_id_list, procedurename,
+                                    parameters))





reply via email to

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