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.
This commit is contained in:
parent
3c4dfb4636
commit
baaa4b1419
1 changed files with 3 additions and 6 deletions
|
|
@ -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 <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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue