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

[profile gen] Add file creation date to simplified profiles

parent 3470567672d7
......@@ -75,6 +75,12 @@ class SEDABinaryDataObject(generated.SEDABinaryDataObject):
def mime_type(self):
return self.reverse_seda_mime_type_from[0] if self.reverse_seda_mime_type_from else None
@property
def date_created_by_application(self):
if self.reverse_seda_date_created_by_application:
return self.reverse_seda_date_created_by_application[0]
return None
@property
def referenced_by(self):
"""Return an iterator on archive unit's content sequences referencing this data-object."""
......
......@@ -990,6 +990,12 @@ class SEDA1XSDExport(SEDA2XSDExport):
'clmIANACharacterSetCode:CharacterSetCodeContentType'),
XAttr('uri', 'xsd:anyURI'),
])
date_created = data_object.date_created_by_application
if date_created:
self.element_schema(document_node, 'Creation', 'udt:DateTimeType',
cardinality=date_created.user_cardinality,
documentation=date_created.user_annotation)
references = list(data_object.referenced_by)
assert len(references) == 1, (
'Unexpected number of references in document {} of {}: {}'.format(
......
......@@ -47,7 +47,7 @@
</ContentDescription>
<Document>
<Attachment encodingCode="7" filename="koala.jpg" mimeCode="image/jpeg"/>
<!-- <Creation>2009-07-14T05:32:31Z</Creation> -->
<Creation>2009-07-14T05:32:31Z</Creation>
<!-- <Identification>75241/a000000041</Identification> -->
<Type listVersionID="edition 2009">RISEM</Type>
</Document>
......
......@@ -876,6 +876,7 @@ class OldSEDARNGExportTC(RelaxNGTestMixin, OldSEDAExportMixin, CubicWebTC):
seda_data_object_reference_id=bdo)
create('SEDAEncoding', seda_encoding_from=bdo)
create('SEDAMimeType', seda_mime_type_from=bdo)
create('SEDADateCreatedByApplication', seda_date_created_by_application=bdo)
cnx.commit()
......
......@@ -159,6 +159,7 @@ bdo_ordered_fields = [
('user_cardinality', 'subject'),
('user_annotation', 'subject'),
('filename', 'subject'),
('seda_date_created_by_application', 'object'),
('seda_compressed', 'object'),
('seda_data_object_version_from', 'object'),
('seda_algorithm', 'object'),
......
......@@ -229,6 +229,10 @@ simplified_pvs.tag_object_of(('*', 'seda_data_object_reference_id', '*'), 'hidde
for rtype in ('seda_compressed', 'seda_data_object_version_from'):
simplified_pvs.tag_object_of(('*', rtype, '*'), 'hidden')
simplified_pvs.tag_object_of(
('*', 'seda_date_created_by_application', 'SEDABinaryDataObject'),
'attributes')
# SEDADataObjectReference
simplified_afs.tag_subject_of(
......
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