[Telepathy-commits] [telepathy-spec/master] Support tp:requires
Davyd Madeley
davyd at madeley.id.au
Mon Mar 23 12:29:27 PDT 2009
---
doc/spec/style.css | 1 +
doc/templates/interface.html | 12 ++++++++++++
tools/specparser.py | 8 ++++++++
3 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/doc/spec/style.css b/doc/spec/style.css
index 0d207c8..0a8f0e2 100644
--- a/doc/spec/style.css
+++ b/doc/spec/style.css
@@ -108,6 +108,7 @@ div.access {
margin-left: 1ex;
}
+div.requires,
div.docstring {
margin: 1ex;
}
diff --git a/doc/templates/interface.html b/doc/templates/interface.html
index ba3892f..3c3e6c3 100644
--- a/doc/templates/interface.html
+++ b/doc/templates/interface.html
@@ -24,6 +24,18 @@
#end if
$interface.get_added_html()
$interface.get_deprecated_html()
+
+ #if $interface.requires
+ <div class="requires">
+ Objects implementing this interface must also implement:
+ <ul>
+ #for $req in $interface.get_requires()
+ <li><a href="$req.get_url()" title="$req.get_title()">$req.name</a></li>
+ #end for
+ </ul>
+ </div>
+ #end if
+
$interface.get_docstring()
#if $interface.methods
diff --git a/tools/specparser.py b/tools/specparser.py
index a15c01b..6a2f184 100644
--- a/tools/specparser.py
+++ b/tools/specparser.py
@@ -326,8 +326,16 @@ class Interface (base):
self.causes_havoc = dom.getAttributeNS (XMLNS_TP, 'causes-havoc')
if self.causes_havoc == '': self.causes_havoc = None
+ # find out what we're required to also implement
+ self.requires = map (lambda n: n.getAttribute ('interface'),
+ getChildrenByName (dom, XMLNS_TP, 'requires'))
+
def get_interface (self):
return self
+
+ def get_requires (self):
+ spec = self.get_spec ()
+ return map (lambda r: spec.lookup (r), self.requires)
def get_url (self):
return '%s.html' % self.name
--
1.5.6.5
More information about the telepathy-commits
mailing list