[Telepathy-commits] [telepathy-spec/master] Return the list of possible errors
Davyd Madeley
davyd at madeley.id.au
Mon Mar 23 12:29:22 PDT 2009
---
doc/templates/interface.html | 13 ++++++++++++-
tools/specparser.py | 17 +++++++++++++----
2 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/doc/templates/interface.html b/doc/templates/interface.html
index 7155cad..af9525d 100644
--- a/doc/templates/interface.html
+++ b/doc/templates/interface.html
@@ -32,6 +32,7 @@
#end for
</div>
#end if
+
#if $method.out_args
<div class="indent">
<h3>Returns</h3>
@@ -41,8 +42,18 @@
<br/>
#end for
</div>
- $method.get_docstring()
#end if
+
+ #if $method.possible_errors
+ <div class="indent">
+ <h3>Possible Errors</h3>
+ #for $error in $method.possible_errors
+ $error<br/>
+ #end for
+ </div>
+ #end if
+
+ $method.get_docstring()
</div>
#end for
</div>
diff --git a/tools/specparser.py b/tools/specparser.py
index 2bca016..f2f54d6 100644
--- a/tools/specparser.py
+++ b/tools/specparser.py
@@ -115,18 +115,25 @@ class base (object):
def __repr__ (self):
return '%s(%s)' % (self.__class__.__name__, self.name)
-
+
+class PossibleError (base):
+ def __init__ (self, parent, namespace, dom):
+ super (PossibleError, self).__init__ (parent, namespace, dom)
+
class Method (base):
def __init__ (self, parent, namespace, dom):
super (Method, self).__init__ (parent, namespace, dom)
- args = build_list (self, Arg, namespace,
+ args = build_list (self, Arg, self.name,
dom.getElementsByTagName ('arg'))
# separate arguments as input and output arguments
self.in_args = filter (lambda a: a.direction == Arg.DIRECTION_IN, args)
self.out_args = filter (lambda a: a.direction == Arg.DIRECTION_OUT, args)
+ self.possible_errors = build_list (self, PossibleError, self.name,
+ dom.getElementsByTagNameNS (XMLNS_TP, 'error'))
+
def get_in_args (self):
return ', '.join (map (lambda a: a.spec_name (), self.in_args))
def get_out_args (self):
@@ -195,7 +202,7 @@ class Signal (base):
def __init__ (self, parent, namespace, dom):
super (Signal, self).__init__ (parent, namespace, dom)
- self.args = build_list (self, Arg, namespace,
+ self.args = build_list (self, Arg, self.name,
dom.getElementsByTagName ('arg'))
def get_args (self):
@@ -226,7 +233,9 @@ class Interface (base):
def get_url (self):
return "%s.html" % self.name
-class Error (base): pass
+class Error (base):
+ def get_url (self):
+ return '#FIXME'
class DBusType (base):
"""The base class for all D-Bus types referred to in the spec.
--
1.5.6.5
More information about the telepathy-commits
mailing list