[Bug 30649] Give warning for unknown interface elements

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Oct 6 13:38:52 CEST 2010


https://bugs.freedesktop.org/show_bug.cgi?id=30649

--- Comment #2 from Will Thompson <will.thompson at collabora.co.uk> 2010-10-06 04:38:52 PDT ---
Great idea.

How about:

  expected_elts = set(
      (XMLNS_DBUS, 'method'),
      ...,
      (XMLNS_TP, 'property'),
      ...)
  surprising_children = [
      x for x in dom.childNodes
        if (x.namespaceURI, x.localName) not in expected_elts
      ]

  for x in surprising_children:
      ...

I'm not sure if it's any clearer.

I think it might be clearer to put the check elsewhere. You could change the
stuff from 'build lists of methods, etc...' onwards in Interface.__init__() to
iterate self, and have a despatch table for each supported element name, crying
about any unrecognised ones. (The code currently uses getElementsByTagNameNS()
which searches all descendants, not just immediate children, but I'm a little
suspicious of that anyway. ☺)

+                dom.getElementsByTagNameNS(XMLNS_TP, 'causes-havoc') +

causes-havoc is an attribute, I think.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the telepathy-bugs mailing list