Fix a few dummy errors

This commit is contained in:
Christophe de Vienne
2011-09-23 10:37:44 +02:00
parent b5eaa27a9a
commit 6dfbe90429
3 changed files with 5 additions and 10 deletions

View File

@@ -154,8 +154,7 @@ class WSRoot(object):
return res
path = protocol.extract_path(request)
func, funcdef = self._lookup_function(path)
kw = protocol.read_arguments(request,
funcdef and funcdef.arguments or None)
kw = protocol.read_arguments(request, funcdef.arguments)
if funcdef.protocol_specific:
kw['root'] = self
@@ -209,15 +208,11 @@ class WSRoot(object):
a = self.protocols[path[1]]
path = path[2:]
print path, a, a.api_wsdl
for name in path:
a = getattr(a, name, None)
if a is None:
break
print a
if not hasattr(a, '_wsme_definition'):
raise exc.UnknownFunction('/'.join(path))

View File

@@ -16,7 +16,7 @@ except ImportError:
@generic
def tojson(datatype, value):
if wsme.types.isstructured(datatype):
if wsme.types.iscomplex(datatype):
d = dict()
for name, attr in wsme.types.list_attributes(datatype):
d[name] = tojson(attr.datatype, getattr(value, name))
@@ -53,7 +53,7 @@ def datetime_tojson(datatype, value):
def fromjson(datatype, value):
if value is None:
return None
if wsme.types.isstructured(datatype):
if wsme.types.iscomplex(datatype):
obj = datatype()
for name, attrdef in wsme.types.list_attributes(datatype):
if name in value:

View File

@@ -24,7 +24,7 @@ def toxml(datatype, key, value):
if value is None:
el.set('nil', 'true')
else:
if wsme.types.isstructured(datatype):
if wsme.types.iscomplex(datatype):
for key, attrdef in datatype._wsme_attributes:
el.append(toxml(attrdef.datatype, key, getattr(value, key)))
else:
@@ -36,7 +36,7 @@ def toxml(datatype, key, value):
def fromxml(datatype, element):
if element.get('nil', False):
return None
if wsme.types.isstructured(datatype):
if wsme.types.iscomplex(datatype):
obj = datatype()
for key, attrdef in datatype._wsme_attributes:
sub = element.find(key)