Commit c51cd249 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[profile gen] Export URL for keyword reference content

not text. Consistently with SEDA 1/0.2 export.
parent dd0fa3ba2760
......@@ -538,7 +538,12 @@ class SEDA2RelaxNGExport(RNGMixin, SEDA2ExportAdapter):
if attrname in ('id', 'href') or attrname.startswith(('list', 'scheme')):
parent_element = self._rng_attribute_parent(occ, None, profile_element)
self._rng_attribute(occ.target, parent_element)
fixed_value = serialize(value, self.cwuri_url)
# special case for KeywordReference content, the only known case where we want URL instead
# of label of its concept value
if value is not None and xselement.local_name == 'KeywordReference':
fixed_value = self.cwuri_url(value)
else:
fixed_value = serialize(value, self.cwuri_url)
if fixed_value is not None:
if _internal_reference(value):
profile_element.attrib[self.qname('a:defaultValue')] = fixed_value
......
......@@ -495,7 +495,7 @@ class SEDA2RNGExportTC(RelaxNGTestMixin, CubicWebTC):
kwr = self.get_element(profile, 'KeywordReference')
self.assertElementDefinition(kwr, {'name': 'KeywordReference',
'type': 'xsd:token',
'fixed': 'theme'})
'fixed': kw_type.cwuri})
self.assertXSDAttributes(
kwr,
[{'name': 'schemeURI', 'fixed': scheme.cwuri}])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment