summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAlex Merry <dev@randomguy3.me.uk>2013-01-05 12:25:25 +0000
committerAlex Merry <dev@randomguy3.me.uk>2013-01-05 12:26:02 +0000
commit93d7d6c686b683b8e920c79d05de759c5f18319e (patch)
treea2bbe6ee03b13412c934dc7a0556a68bd72ed1e9 /tools
parent6cc73faa9ebfc529a45a361482412ed7eba56960 (diff)
Use annotations to indicate optional properties
Also, add in tp:added elements where appropriate to indicate when things were added to the spec.
Diffstat (limited to 'tools')
-rw-r--r--tools/specparser.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/specparser.py b/tools/specparser.py
index d680896..9ea9d41 100644
--- a/tools/specparser.py
+++ b/tools/specparser.py
@@ -638,6 +638,8 @@ class Property(DBusConstruct, Typed):
else:
raise UnknownAccess("Unknown access '%s' on %s" % (access, self))
+ self.is_optional = (getAnnotationByName(dom, 'org.mpris.MediaPlayer2.property.optional') == 'true')
+
is_cp = dom.getAttributeNS(XMLNS_TP, 'is-connection-parameter')
self.is_connection_parameter = is_cp != ''
@@ -687,6 +689,12 @@ class Property(DBusConstruct, Typed):
return ', '.join(descriptions)
+ def get_optional(self):
+ if self.is_optional:
+ return '<div class="annotation optional">This property is optional. Clients should handle its absence gracefully.</div>'
+ else:
+ return ''
+
class AwkwardTelepathyProperty(Typed):
def get_type_name(self):
return 'Telepathy Property'