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

[html gen] Support for list as target value

which will occurs when the profile has some data object linked to several mime
types or format ids. Tests setup is shared with profile generation, so modify it
there, it won't hurt the original functional case to cover this as well.

Closes #36331831
parent cc3b3e0f6d42
......@@ -238,17 +238,26 @@ class SEDA2HTMLExport(SEDA2ExportAdapter):
attributes={'class': 'label'})
xstypes = self._cw._(' ALT_I18N ').join(u'xsd:' + xstype for xstype in xstypes)
self.element('span', ct_div, text=xstypes, attributes={'class': 'value'})
fixed_value = self.serialize(target_value)
if fixed_value is None:
return
value_div = self.element('div', div)
self.element('span', value_div, text=self._cw._('fixed value'),
attributes={'class': 'label'})
if isinstance(fixed_value, string_types):
self.element('span', value_div, text=fixed_value, attributes={'class': 'value'})
if target_value is None:
values = ()
elif not isinstance(target_value, list):
values = [target_value]
else:
span = self.element('span', value_div, attributes={'class': 'value'})
span.append(fixed_value)
values = target_value
value_div = None
for value in values:
fixed_value = self.serialize(value)
if fixed_value is None:
continue
if value_div is None:
value_div = self.element('div', div)
self.element('span', value_div, text=self._cw._('fixed value'),
attributes={'class': 'label'})
if isinstance(fixed_value, string_types):
self.element('span', value_div, text=fixed_value, attributes={'class': 'value'})
else:
span = self.element('span', value_div, attributes={'class': 'value'})
span.append(fixed_value)
def concept_scheme_attribute(self, xselement, div, scheme):
try:
......
......@@ -609,6 +609,7 @@ class SEDAExportFuncTCMixIn(object):
scheme = create('ConceptScheme', title=u'Keyword Types')
# ensure we're able to export concept with unexpected language code
some_concept = scheme.add_concept(label=u'md5', language_code=u'de')
some_other_concept = scheme.add_concept(label=u'hash/md5', language_code=u'de')
transfer = create('SEDAArchiveTransfer', title=u'test profile')
create('SEDAMessageDigestAlgorithmCodeListVersion',
......@@ -629,6 +630,7 @@ class SEDAExportFuncTCMixIn(object):
# binary data object
bdo = testutils.create_data_object(transfer, user_cardinality=u'0..n',
seda_algorithm=some_concept)
bdo.mime_type.cw_set(seda_mime_type_to=[some_concept, some_other_concept])
create('SEDAFormatLitteral',
user_cardinality=u'0..1',
seda_format_litteral=bdo)
......
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