[PATCH saem] [ui] Use None instead of empty string as 'no field' marker

Sylvain Thenault sylvain.thenault at logilab.fr
Thu Oct 5 11:01:20 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1507130982 -7200
#      Wed Oct 04 17:29:42 2017 +0200
# Node ID 398e007618c4cf79515dff24e40cf024e822e55e
# Parent  215426b6e3415c6ac0e7b948d836eaf84eb7d719
# Available At http://hg.logilab.org/review/cubes/saem_ref
#              hg pull http://hg.logilab.org/review/cubes/saem_ref -r 398e007618c4
[ui] Use None instead of empty string as 'no field' marker

this seems expected by cubicweb's default renderer, else it attempts to translate
it anyway, leading to po file header to be inserted, which is not very nice for
the end user.

diff --git a/cubicweb_saem_ref/hooks.py b/cubicweb_saem_ref/hooks.py
--- a/cubicweb_saem_ref/hooks.py
+++ b/cubicweb_saem_ref/hooks.py
@@ -214,11 +214,11 @@ def set_ark_and_cwuri(cw, eid, etype, en
         ark = None if cwuri is None else extract_ark(cwuri)
         if ark is None:
             if naa_what is None:
                 msg = _('an ARK identifier has to be generated but no Name Assigning Authority is '
                         'specified')
-                raise ValidationError(None, {'': msg})
+                raise ValidationError(None, {None: msg})
             generator = cw.vreg['adapters'].select('IARKGenerator', cw, eid=eid, etype=etype,
                                                    naa_what=naa_what)
             ark = generator.generate_ark()
         entity_attrs['ark'] = ark
     if 'cwuri' not in entity_attrs:


More information about the saem-devel mailing list