[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r6891 - in trunk/gnue-common/src/rpc/drivers/xmlrpc: pw_xmlrpc py
From: |
jan |
Subject: |
[gnue] r6891 - in trunk/gnue-common/src/rpc/drivers/xmlrpc: pw_xmlrpc py_xmlrpc |
Date: |
Tue, 11 Jan 2005 13:07:53 -0600 (CST) |
Author: jan
Date: 2005-01-11 13:07:51 -0600 (Tue, 11 Jan 2005)
New Revision: 6891
Modified:
trunk/gnue-common/src/rpc/drivers/xmlrpc/pw_xmlrpc/typeconv.py
trunk/gnue-common/src/rpc/drivers/xmlrpc/py_xmlrpc/typeconv.py
Log:
Fix bug occuring with py_xmlrpc.
Because "isinstance(True,types.IntType)" returns True we have to check for
Boolean first.
Modified: trunk/gnue-common/src/rpc/drivers/xmlrpc/pw_xmlrpc/typeconv.py
===================================================================
--- trunk/gnue-common/src/rpc/drivers/xmlrpc/pw_xmlrpc/typeconv.py
2005-01-11 08:17:00 UTC (rev 6890)
+++ trunk/gnue-common/src/rpc/drivers/xmlrpc/pw_xmlrpc/typeconv.py
2005-01-11 19:07:51 UTC (rev 6891)
@@ -42,6 +42,11 @@
elif isinstance (value, types.UnicodeType):
return value
+ # Boolean (has to be checked before IntType)
+ elif hasattr (types, 'BooleanType') and \
+ isinstance (value, types.BooleanType):
+ return xmlrpclib.boolean (value)
+
# Number
elif isinstance (value, types.IntType):
return value
@@ -58,11 +63,6 @@
elif isinstance (value, mx.DateTime.DateTimeDeltaType):
return xmlrpclib.DateTime ((1, 1, 1, value.hour, value.minute,
int (value.second), 1, 1, 1))
- # Boolean
- elif hasattr (types, 'BooleanType') and \
- isinstance (value, types.BooleanType):
- return xmlrpclib.boolean (value)
-
# List
elif isinstance (value, types.ListType):
return [python_to_rpc (element, exception) for element in value]
Modified: trunk/gnue-common/src/rpc/drivers/xmlrpc/py_xmlrpc/typeconv.py
===================================================================
--- trunk/gnue-common/src/rpc/drivers/xmlrpc/py_xmlrpc/typeconv.py
2005-01-11 08:17:00 UTC (rev 6890)
+++ trunk/gnue-common/src/rpc/drivers/xmlrpc/py_xmlrpc/typeconv.py
2005-01-11 19:07:51 UTC (rev 6891)
@@ -30,7 +30,7 @@
# -----------------------------------------------------------------------------
def python_to_rpc (value, exception):
-
+ print "converting value %s of type %s " % (value,type(value))
# None
if value is None:
return ''
@@ -41,6 +41,14 @@
elif isinstance (value, types.UnicodeType):
return value.encode ('utf-8')
+ # Boolean (has to be checked before Integer, as it inherites int)
+ elif hasattr (types, 'BooleanType') and \
+ isinstance (value, types.BooleanType):
+ if value:
+ return xmlrpc.boolean (True)
+ else:
+ return xmlrpc.boolean (False)
+
# Number
elif isinstance (value, types.IntType):
return value
@@ -59,14 +67,6 @@
return xmlrpc.dateTime (y, m, d, value.hour, value.minute,
int (value.second))
- # Boolean
- elif hasattr (types, 'BooleanType') and \
- isinstance (value, types.BooleanType):
- if value:
- return xmlrpc.boolean (True)
- else:
- return xmlrpc.boolean (False)
-
# List
elif isinstance (value, types.ListType):
return [python_to_rpc (element, exception) for element in value]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r6891 - in trunk/gnue-common/src/rpc/drivers/xmlrpc: pw_xmlrpc py_xmlrpc,
jan <=