From baaa4b14195dbf8ceca3980af7971f01a423bd91 Mon Sep 17 00:00:00 2001 From: Goffi Date: Fri, 27 Oct 2017 17:54:00 +0200 Subject: [PATCH] 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. --- src/plugins/plugin_exp_pubsub_schema.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/plugin_exp_pubsub_schema.py b/src/plugins/plugin_exp_pubsub_schema.py index a473f4ef..8269d0ff 100755 --- a/src/plugins/plugin_exp_pubsub_schema.py +++ b/src/plugins/plugin_exp_pubsub_schema.py @@ -34,7 +34,6 @@ from collections import Iterable 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 @@ class PubsubSchema(object): schema_elt = next(iq_elt.elements(NS_SCHEMA, 'schema')) except StopIteration: raise exceptions.DataError('missing 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):