Mercurial > libervia-backend
diff src/plugins/plugin_exp_pubsub_schema.py @ 2395:713cedc99752
plugin pubsub schema: allow any data_form schema:
the schema is actually the schema needed for the items, so it should not in pubsub schema namespace.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 27 Oct 2017 17:54:00 +0200 |
parents | 4c883d1c3e81 |
children | 3ff9d7a7fe71 |
line wrap: on
line diff
--- a/src/plugins/plugin_exp_pubsub_schema.py Fri Oct 27 08:36:24 2017 +0200 +++ b/src/plugins/plugin_exp_pubsub_schema.py Fri Oct 27 17:54:00 2017 +0200 @@ -34,7 +34,6 @@ import copy NS_SCHEMA = 'https://salut-a-toi/protocol/schema:0' -NS_SCHEMA_FORM = 'https://salut-a-toi/protocol/schema#schema:0' PLUGIN_INFO = { C.PI_NAME: "PubSub Schema", @@ -98,13 +97,11 @@ schema_elt = next(iq_elt.elements(NS_SCHEMA, 'schema')) except StopIteration: raise exceptions.DataError('missing <schema> element') - schema_form = data_form.findForm(schema_elt, NS_SCHEMA_FORM) - if schema_form is None: + try: + x_elt = next(schema_elt.elements((data_form.NS_X_DATA, 'x'))) + except StopIteration: # there is not schema on this node return None - # we get again the form because we need all elements/namespaces - # while schema_form.toElement while only keep XEP-0004 elements - x_elt = next(schema_elt.elements(data_form.NS_X_DATA, 'x')) return x_elt def getSchema(self, client, service, nodeIdentifier):