- row.appendChild(entryElement(""))
-
- # Parameter documentation
- row.appendChild(entryElement(doc))
-
- # Indent the name of each sub-parameter
- subparams = []
- if isinstance(param, dict):
- subparams = param.iteritems()
- elif isinstance(param, Mixed):
- subparams = [(name, subparam) for subparam in param]
- elif isinstance(param, (list, tuple)):
- subparams = [("", subparam) for subparam in param]
-
- for name, subparam in subparams:
- if isinstance(subparam, Parameter):
- (optional, doc) = (subparam.optional, subparam.doc)
- else:
- (optional, doc) = (None, "")
- rows += parameters(subparam, name, optional, doc, indent + step, step)
-
- return rows
-
-for method in api.methods:
- func = api.callable(method)
- (min_args, max_args, defaults) = func.args()
-
- section = Element('section')
- section.setAttribute('id', func.name)
- section.appendChild(simpleElement('title', func.name))
-
- para = paraElement('Status:')
- para.appendChild(blockquoteElement(func.status))
- section.appendChild(para)
-
- prototype = "%s (%s)" % (method, ", ".join(max_args))
- para = paraElement('Prototype:')
- para.appendChild(blockquoteElement(prototype))
- section.appendChild(para)
-
- para = paraElement('Description:')
- para.appendChild(blockquoteElement(func.__doc__))
- section.appendChild(para)
-
- para = paraElement('Parameters:')
- blockquote = blockquoteElement()
- para.appendChild(blockquote)
- section.appendChild(para)
-
- head = rowElement(['Name', 'Type', 'Optional', 'Description'])
- rows = []
-
- indent = " "
- for name, param, default in zip(max_args, func.accepts, defaults):
- optional = name not in min_args
+ return xmlrpc_type(python_type(param))
+
+class paramElement(Element):
+ """An optionally named parameter."""
+ def __init__(self, name, param):
+ # <listitem>
+ Element.__init__(self, 'listitem')
+
+ description = Element('para')
+
+ if name:
+ description.appendChild(simpleElement('parameter', name))
+ description.appendChild(TrimText(": "))
+
+ description.appendChild(TrimText(param_type(param)))
+
+ if isinstance(param, (list, tuple, set)) and len(param) == 1:
+ param = param[0]
+