From 837d81181adb71153aec7ccb7e7f4b5d160e4ee8 Mon Sep 17 00:00:00 2001 From: Mark Huang Date: Wed, 25 Oct 2006 14:32:01 +0000 Subject: [PATCH] - remove default attribute from Parameter - handle unknown optional attribute --- doc/DocBook.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/doc/DocBook.py b/doc/DocBook.py index a62ef9b..8634a8f 100755 --- a/doc/DocBook.py +++ b/doc/DocBook.py @@ -6,7 +6,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id$ +# $Id: DocBook.py,v 1.1 2006/09/06 15:34:41 mlhuang Exp $ # import xml.dom.minidom @@ -125,7 +125,7 @@ class informaltableElement(Element): cols = len(thead.childNodes[0].childNodes) tgroup.setAttribute('cols', str(cols)) -def parameters(param, name, optional, default, doc, indent, step): +def parameters(param, name, optional, doc, indent, step): """Format a parameter into parameter row(s).""" rows = [] @@ -143,13 +143,10 @@ def parameters(param, name, optional, default, doc, indent, step): row.appendChild(entryElement(xmlrpc_type(param_type))) # Whether parameter is optional - row.appendChild(entryElement(str(bool(optional)))) - - # Parameter default - if optional and default is not None: - row.appendChild(entryElement(unicode(default))) + if optional is not None: + row.appendChild(entryElement(str(bool(optional)))) else: - row.appendChild(entryElement()) + row.appendChild(entryElement("")) # Parameter documentation row.appendChild(entryElement(doc)) @@ -165,11 +162,10 @@ def parameters(param, name, optional, default, doc, indent, step): for name, subparam in subparams: if isinstance(subparam, Parameter): - (optional, default, doc) = (subparam.optional, subparam.default, subparam.doc) + (optional, doc) = (subparam.optional, subparam.doc) else: - # All named sub-parameters are optional if not otherwise specified - (optional, default, doc) = (True, None, "") - rows += parameters(subparam, name, optional, default, doc, indent + step, step) + (optional, doc) = (None, "") + rows += parameters(subparam, name, optional, doc, indent + step, step) return rows @@ -199,7 +195,7 @@ for method in api.methods: para.appendChild(blockquote) section.appendChild(para) - head = rowElement(['Name', 'Type', 'Optional', 'Default', 'Description']) + head = rowElement(['Name', 'Type', 'Optional', 'Description']) rows = [] indent = " " @@ -209,7 +205,7 @@ for method in api.methods: doc = param.doc else: doc = "" - rows += parameters(param, name, optional, default, doc, "", indent) + rows += parameters(param, name, optional, doc, "", indent) if rows: informaltable = informaltableElement(head, rows) -- 2.45.2