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

[profile gen] Consider SEDAMimeType on SEDA 1.0 / 0.2 export

to control appearance of the mimeCode attribute which was previously always
forbidden.
parent e8f14e28f4e0
......@@ -65,6 +65,10 @@ class SEDABinaryDataObject(generated.SEDABinaryDataObject):
def encoding(self):
return self.reverse_seda_encoding_from[0] if self.reverse_seda_encoding_from else None
@property
def mime_type(self):
return self.reverse_seda_mime_type_from[0] if self.reverse_seda_mime_type_from else None
@property
def referenced_by(self):
"""Return an iterator on archive unit's content sequences referencing this data-object."""
......@@ -261,6 +265,13 @@ class SEDAEncoding(generated.SEDAEncoding):
return self.seda_encoding_to[0] if self.seda_encoding_to else None
class SEDAMimeType(generated.SEDAMimeType):
@property
def concept(self):
return self.seda_mime_type_to[0] if self.seda_mime_type_to else None
class SEDAType(generated.SEDAType):
@property
......
......@@ -1092,6 +1092,7 @@ class SEDA1XSDExport(SEDA2XSDExport):
format_id = data_object.format_id
encoding = data_object.encoding
mime_type = data_object.mime_type
self.element_schema(document_node, 'Attachment', 'qdt:ArchivesBinaryObjectType',
xsd_attributes=[
XAttr('format', 'clmDAFFileTypeCode:FileTypeCodeType',
......@@ -1101,13 +1102,15 @@ class SEDA1XSDExport(SEDA2XSDExport):
'clm60133:CharacterSetEncodingCodeContentType',
cardinality=safe_cardinality(encoding),
fixed_value=safe_concept_value(encoding)),
XAttr('mimeCode', 'clmIANAMIMEMediaType:MIMEMediaTypeContentType',
cardinality=safe_cardinality(mime_type),
fixed_value=safe_concept_value(mime_type)),
XAttr('filename', 'xsd:string',
cardinality='0..1',
fixed_value=data_object.filename),
# hard-coded attributes
XAttr('characterSetCode',
'clmIANACharacterSetCode:CharacterSetCodeContentType'),
XAttr('mimeCode', 'clmIANAMIMEMediaType:MIMEMediaTypeContentType'),
XAttr('uri', 'xsd:anyURI'),
])
references = list(data_object.referenced_by)
......
......@@ -340,9 +340,9 @@
<xsd:extension base="qdt:ArchivesBinaryObjectType">
<xsd:attribute fixed="fmt/123" name="format" type="clmDAFFileTypeCode:FileTypeCodeType" use="required"/>
<xsd:attribute fixed="6" name="encodingCode" type="clm60133:CharacterSetEncodingCodeContentType" use="required"/>
<xsd:attribute name="mimeCode" type="clmIANAMIMEMediaType:MIMEMediaTypeContentType" use="prohibited"/>
<xsd:attribute fixed="this_is_the_filename.pdf" name="filename" type="xsd:string" use="optional"/>
<xsd:attribute name="characterSetCode" type="clmIANACharacterSetCode:CharacterSetCodeContentType" use="prohibited"/>
<xsd:attribute name="mimeCode" type="clmIANAMIMEMediaType:MIMEMediaTypeContentType" use="prohibited"/>
<xsd:attribute name="uri" type="xsd:anyURI" use="prohibited"/>
</xsd:extension>
</xsd:simpleContent>
......
......@@ -346,9 +346,9 @@
<xsd:extension base="qdt:ArchivesBinaryObjectType">
<xsd:attribute fixed="fmt/123" name="format" type="clmDAFFileTypeCode:FileTypeCodeType" use="required"/>
<xsd:attribute fixed="6" name="encodingCode" type="clm60133:CharacterSetEncodingCodeContentType" use="required"/>
<xsd:attribute name="mimeCode" type="clmIANAMIMEMediaType:MIMEMediaTypeContentType" use="prohibited"/>
<xsd:attribute fixed="this_is_the_filename.pdf" name="filename" type="xsd:string" use="optional"/>
<xsd:attribute name="characterSetCode" type="clmIANACharacterSetCode:CharacterSetCodeContentType" use="prohibited"/>
<xsd:attribute name="mimeCode" type="clmIANAMIMEMediaType:MIMEMediaTypeContentType" use="prohibited"/>
<xsd:attribute name="uri" type="xsd:anyURI" use="prohibited"/>
</xsd:extension>
</xsd:simpleContent>
......
Supports Markdown
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