[PATCH 1 of 9 seda] [schema] Add file_category relation to binary data objects

Sylvain Thenault sylvain.thenault at logilab.fr
Thu Oct 12 16:59:46 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1507727463 -7200
#      Wed Oct 11 15:11:03 2017 +0200
# Node ID 82e332e6c5b8b0ad6a89eaac1ae19b27f8060715
# Parent  32150c18b18840d0ba9b494498ffae565b3a818f
# Available At https://hg.logilab.org/review/cubes/seda
#              hg pull https://hg.logilab.org/review/cubes/seda -r 82e332e6c5b8
[schema] Add file_category relation to binary data objects

This relation will be used in later csets to link the file to a high-level file
format, that will be used to control low-level mime  type and format id fields.

Related to extranet #36331831

diff --git a/cubicweb_seda/migration/0.11.0_Any.py b/cubicweb_seda/migration/0.11.0_Any.py
--- a/cubicweb_seda/migration/0.11.0_Any.py
+++ b/cubicweb_seda/migration/0.11.0_Any.py
@@ -42,5 +42,6 @@ for i, concept in enumerate(rset.entitie
         cnx.commit()
 
 
 sync_schema_props_perms('user_cardinality')
 
+add_relation_type('file_category')
diff --git a/cubicweb_seda/schema/__init__.py b/cubicweb_seda/schema/__init__.py
--- a/cubicweb_seda/schema/__init__.py
+++ b/cubicweb_seda/schema/__init__.py
@@ -83,10 +83,19 @@ class seda_keyword_reference_to_scheme(R
     object = 'ConceptScheme'
     cardinality = '?*'
     inlined = True
 
 
+class file_category(RelationDefinition):
+    subject = 'SEDABinaryDataObject'
+    object = 'Concept'
+    cardinality = '**'
+    constraints = [
+        RQLConstraint('O in_scheme CS, CS scheme_relation_type CR, CR name "file_category"'),
+    ]
+
+
 class container(RelationType):
     inlined = False
 
 
 class _clone_of(RelationDefinition):


More information about the saem-devel mailing list