Re: [PATCH saem_ref] Do not import "Catégories de fichier" SEDA vocabulary on db creation

Denis Laxalde denis.laxalde at logilab.fr
Fri Mar 8 09:49:02 CET 2019


Denis Laxalde a écrit :
> # HG changeset patch
> # User Denis Laxalde <denis.laxalde at logilab.fr>
> # Date 1551978912 -3600
> #      Thu Mar 07 18:15:12 2019 +0100
> # Node ID 362ee744e83d383590a0e4360b27394f5b39f42c
> # Parent  3290a6c7f4923706ef0eb3b517a583e1270627cd
> # Available At http://hg.logilab.org/review/cubes/saem_ref
> #              hg pull http://hg.logilab.org/review/cubes/saem_ref -r 362ee744e83d
> Do not import "Catégories de fichier" SEDA vocabulary on db creation

Ignore this patch for now, I'm not sure this is the way to go.

> 
> We want this vocabulary to be managed as a SKOSSource.
> We thus modify the LSCV_FILES list that is used during postcreate (in
> cubicweb-seda) to initialize SEDA vocabularies and drop this item.
> 
> Then, since we still need to have the "scheme_relation_type" set on the
> vocabulary, we make the relation appear in ConceptScheme edition form.
> 
> diff --git a/cubicweb_saem_ref/site_cubicweb.py b/cubicweb_saem_ref/site_cubicweb.py
> --- a/cubicweb_saem_ref/site_cubicweb.py
> +++ b/cubicweb_saem_ref/site_cubicweb.py
> @@ -140,6 +140,20 @@ ImportSkosData.cw_store_factories['massi
>  ImportSkosData.cw_store_factories['nohook'] = _nohook_store_factory
>  
>  
> +def _customize_seda_vocabularies():
> +    """Adjust the list of LCSV files imported during cubicweb-seda's instance creation.
> +    """
> +    files = seda_dataimport.LCSV_FILES
> +    # Remove "Catégories de fichier" since we want this vocabulary to be
> +    # managed as a SKOS Source.
> +    idx = [title for title, _, _, _ in files].index(u'Catégories de fichier')
> +    del files[idx]
> +
> +
> +_customize_seda_vocabularies()
> +del _customize_seda_vocabularies
> +
> +
>  # override seda's scheme initialization to set ark on each scheme, and to use an ark enabled store
>  
>  @monkeypatch(seda_dataimport)
> diff --git a/cubicweb_saem_ref/views/seda.py b/cubicweb_saem_ref/views/seda.py
> --- a/cubicweb_saem_ref/views/seda.py
> +++ b/cubicweb_saem_ref/views/seda.py
> @@ -1,3 +1,4 @@
> +# coding: utf-8
>  # copyright 2015 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
>  # contact http://www.logilab.fr -- mailto:contact at logilab.fr
>  #
> @@ -36,6 +37,12 @@ affk = uicfg.autoform_field_kwargs
>  afs = uicfg.autoform_section
>  pvs = uicfg.primaryview_section
>  
> +
> +# show "scheme_relation_type" as we need it be editable for SEDA schemes
> +# created from a SKOS source (e.g. "Catégories de fichier")
> +afs.tag_subject_of(('*', 'scheme_relation_type', '*'), 'main', 'attributes')
> +
> +
>  # also hide transferring and archival agency
>  for rtype in ('seda_transferring_agency', 'seda_archival_agency'):
>      afs.tag_subject_of(('SEDAArchiveTransfer', rtype, '*'), 'main', 'hidden')
> 



More information about the saem-devel mailing list