fix error cases when internationalizable is not defined on rdef

authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
changesetcc0ed3bb4c56
branch3.26
phasedraft
hiddenno
parent revision#f783f7d1d455 Added tag 3.26.19, debian/3.26.19-1 for changeset d5fb8ecdd5c0
child revision<not specified>
files modified by this revision
cubicweb/devtools/fill.py
# HG changeset patch
# User Nicolas Chauvat <nicolas.chauvat@logilab.fr>
# Date 1583879021 -3600
# Tue Mar 10 23:23:41 2020 +0100
# Branch 3.26
# Node ID cc0ed3bb4c5646d6a64e02326ac2121180d4e69f
# Parent f783f7d1d45598bc7f606b14ef313e552f5b3f07
fix error cases when internationalizable is not defined on rdef

diff --git a/cubicweb/devtools/fill.py b/cubicweb/devtools/fill.py
@@ -119,11 +119,11 @@
1              return choosed
2          # All other case, generate a default string
3          attrlength = get_max_length(self.eschema, attrname)
4          num_len = numlen(index)
5          if num_len >= attrlength:
6 -            ascii = self.eschema.rdef(attrname).internationalizable
7 +            ascii = getattr(self.eschema.rdef(attrname), 'internationalizable', False)
8              return ('&'+decompose_b26(index, ascii))[:attrlength]
9          # always use plain text when no format is specified
10          attrprefix = attrname[:max(attrlength-num_len-1, 0)]
11          if format == 'text/html':
12              value = u'<span>�%s<b>%d</b></span>' % (attrprefix, index)