[saem-devel] [PATCH] Set NameEntry.form_variant's default using uicfg rather then in the schema

Sylvain Thenault sylvain.thenault at logilab.fr
Tue Jan 31 15:29:22 CET 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1485872955 -3600
#      Tue Jan 31 15:29:15 2017 +0100
# Node ID d66054fd72ce1c7b309de16f147aa2882fce32a5
# Parent  a4314691c4258f28ed6cf7459e914f7ea5f687e0
Set NameEntry.form_variant's default using uicfg rather then in the schema

To avoid unexpected behaviour when records are imported from EAC files.

diff --git a/cubicweb_saem_ref/schema.py b/cubicweb_saem_ref/schema.py
--- a/cubicweb_saem_ref/schema.py
+++ b/cubicweb_saem_ref/schema.py
@@ -126,13 +126,12 @@ EmailAddress.remove_relation('alias')
 
 
 # Customization of eac schema.
 make_workflowable(AuthorityRecord)
 groups_permissions(AuthorityRecord)
-# XXX those can be removed once we depend on eac > 0.3
+# XXX can be removed once we depend on eac > 0.3
 NameEntry.get_relation('form_variant').internationalizable = True
-NameEntry.get_relation('form_variant').default = u'authorized'
 
 
 # Customization of skos schema.
 make_workflowable(ConceptScheme)
 publication_permissions(ConceptScheme)
diff --git a/cubicweb_saem_ref/views/authorityrecord.py b/cubicweb_saem_ref/views/authorityrecord.py
--- a/cubicweb_saem_ref/views/authorityrecord.py
+++ b/cubicweb_saem_ref/views/authorityrecord.py
@@ -158,10 +158,12 @@ def get_record_names(form, field):
     return form._cw.execute('Any P WHERE NE parts P, NE is NameEntry').rows
 
 
 affk.set_field_kwargs('NameEntry', 'parts',
                       widget=TextInputCheckSimilar({'size': 80}, data_initfunc=get_record_names))
+# XXX can be removed once we depend on eac > 0.3
+affk.set_field_kwargs('NameEntry', 'form_variant', value=u'authorized')
 
 
 # hide record_id for now
 pvs.tag_attribute(('AuthorityRecord', 'record_id'), 'hidden')
 afs.tag_attribute(('AuthorityRecord', 'record_id'), 'main', 'hidden')


More information about the saem-devel mailing list