commit-gnue
[Top][All Lists]
Advanced

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

r5740 - trunk/gnue-appserver/src


From: reinhard
Subject: r5740 - trunk/gnue-appserver/src
Date: Sun, 18 Apr 2004 16:06:33 -0500 (CDT)

Author: reinhard
Date: 2004-04-18 16:06:32 -0500 (Sun, 18 Apr 2004)
New Revision: 5740

Modified:
   trunk/gnue-appserver/src/geasSession.py
   trunk/gnue-appserver/src/test.py
Log:
Fixed indirect properties for load (), extended self test code.


Modified: trunk/gnue-appserver/src/geasSession.py
===================================================================
--- trunk/gnue-appserver/src/geasSession.py     2004-04-18 20:43:42 UTC (rev 
5739)
+++ trunk/gnue-appserver/src/geasSession.py     2004-04-18 21:06:32 UTC (rev 
5740)
@@ -72,14 +72,6 @@
     return self.sm.classes [classname]
 
   # ---------------------------------------------------------------------------
-  # Get a list of field names from a list of property names
-  # ---------------------------------------------------------------------------
-
-  def __getFieldlist (self, classdef, propertylist):
-
-    return ([classdef.properties[p].column for p in propertylist])
-
-  # ---------------------------------------------------------------------------
   # Get a field name from a property name, resolving references
   # ---------------------------------------------------------------------------
 
@@ -246,7 +238,9 @@
   def __findInstance (self, classdef, object_id, propertylist):
 
     table = classdef.table
-    fieldlist = self.__getFieldlist (classdef, propertylist)
+    # Only query the main table here.  geasInstance.get will do the rest.
+    fieldlist = [classdef.properties [string.split (p, '.') [0]].column
+                 for p in propertylist]
     record = self.__connection.findRecord (table, object_id, fieldlist)
     return geasInstance.geasInstance (self, self.__connection, record,
                                       classdef)

Modified: trunk/gnue-appserver/src/test.py
===================================================================
--- trunk/gnue-appserver/src/test.py    2004-04-18 20:43:42 UTC (rev 5739)
+++ trunk/gnue-appserver/src/test.py    2004-04-18 21:06:32 UTC (rev 5740)
@@ -58,36 +58,66 @@
   def run (self):
     sm = self.getSessionManager ()
 
-    print "Opening session ..."
+    print "Opening session ...",
     session = sm.open ({"user":"hacker", "password":"secret"})
+    print "Ok"
 
-    print "Creating and populating list object ..."
+    print "Creating and populating list object ...",
     list = sm.request (session, "address_person", [], ["address_zip"],
                        ["address_name", "address_street", "address_city",
                         "address_country.address_code",
                         "address_country.address_name"])
+    print "Ok"
 
-    print "Retrieving first instance ..."
+    print "Retrieving first instance ...",
     rset = sm.fetch (session,list,0,1)
+    first_id = rset[0][0]
+    print "Ok"
 
     print "These are the values of the first instance:"
     print "  Name   :", rset[0][1]
     print "  Street :", rset[0][2]
     print "  City   :", rset[0][3]
-    print "  Country:", rset[0][4]
-    print "          ", rset[0][5]
+    print "  Country:", rset[0][4] + '/' + rset[0][5]
 
+    print "Retrieving second instance ...",
+    rset = sm.fetch (session,list,1,1)
+    print "Ok"
+
+    print "These are the values of the second instance:"
+    print "  Name   :", rset[0][1]
+    print "  Street :", rset[0][2]
+    print "  City   :", rset[0][3]
+    print "  Country:", rset[0][4] + '/' + rset[0][5]
+
+    print "Executing rollback to clear cache ...",
+    sm.rollback (session)
+    print "Ok"
+
+    print "Loading the first instance with load () ...",
+    rset = sm.load (session, "address_person", [first_id],
+                    ["address_name", "address_street", "address_city",
+                     "address_country.address_code",
+                     "address_country.address_name"])
+    print "Ok"
+
+    print "These are again the values of the first instance:"
+    print "  Name   :", rset[0][0]
+    print "  Street :", rset[0][1]
+    print "  City   :", rset[0][2]
+    print "  Country:", rset[0][3] + '/' + rset[0][4]
+
     print "Now I call the procedure 'show' for the first instance:"
-    sm.call (session, "address_person", [rset[0][0]], "address_show", {})
+    sm.call (session, "address_person", [first_id], "address_show", {})
 
     print "Now I call the procedure 'test' for the first instance:"
-    sm.call (session, "address_person", [rset[0][0]], "address_test", {})
+    sm.call (session, "address_person", [first_id], "address_test", {})
 
-    print "Committing and closing session ..."
+    print "Committing and closing session ...",
     sm.close (session, 1)
+    print "Ok"
 
 
-
 # =============================================================================
 # Login Handler
 # =============================================================================





reply via email to

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