changeset 361:a92f482ff14f

schema: allow free FORM_TYPE as this is used for items validation, and should not be in schema namespace
author Goffi <goffi@goffi.org>
date Fri, 27 Oct 2017 18:27:18 +0200
parents 6350622d9eb9
children 6ee61218a33f
files sat_pubsub/const.py sat_pubsub/schema.py
diffstat 2 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/sat_pubsub/const.py	Fri Oct 13 20:57:47 2017 +0200
+++ b/sat_pubsub/const.py	Fri Oct 27 18:27:18 2017 +0200
@@ -57,7 +57,6 @@
 NS_ATOM = "http://www.w3.org/2005/Atom"
 NS_FORWARD = 'urn:xmpp:forward:0'
 NS_SCHEMA = 'https://salut-a-toi/protocol/schema:0'
-NS_SCHEMA_FORM = 'https://salut-a-toi/protocol/schema#schema:0'
 NS_SCHEMA_RESTRICT = 'https://salut-a-toi/protocol/schema#restrict:0'
 
 OPT_ACCESS_MODEL = 'pubsub#access_model'
--- a/sat_pubsub/schema.py	Fri Oct 13 20:57:47 2017 +0200
+++ b/sat_pubsub/schema.py	Fri Oct 27 18:27:18 2017 +0200
@@ -85,11 +85,9 @@
         requestor = jid.JID(iq_elt['from'])
         pep = iq_elt.delegated
         recipient = jid.JID(iq_elt['to'])
-        for x_elt in schema_elt.elements(data_form.NS_X_DATA, u'x'):
-            schema_form = data_form.Form.fromElement(x_elt)
-            if schema_form.formNamespace == const.NS_SCHEMA_FORM:
-                break
-        else:
+        try:
+            x_elt = next(schema_elt.elements(data_form.NS_X_DATA, u'x'))
+        except StopIteration:
             # no schema form has been found
             x_elt = None
         d = self.backend.setNodeSchema(nodeIdentifier,