appy.gen: bugfixes in List field and in master-slave relationships.

This commit is contained in:
Gaetan Delannay 2011-10-27 17:55:17 +02:00
parent 3ab6cec7d6
commit 331db304e7
3 changed files with 10 additions and 6 deletions

View file

@ -2278,10 +2278,13 @@ class List(Type):
def getStorableValue(self, value):
'''Gets p_value in a form that can be stored in the database.'''
res = []
for v in value:
sv = Object()
for name, field in self.fields:
setattr(v, name, field.getStorableValue(getattr(v, name)))
return value
setattr(sv, name, field.getStorableValue(getattr(v, name)))
res.append(sv)
return res
def getInnerValue(self, outerValue, name, i):
'''Returns the value of inner field named p_name in row number p_i

View file

@ -23,9 +23,9 @@
tal:condition="python: isEdit or value"
tal:attributes="id python: 'list_%s' % name">
<tal:comment replace="nothing">Header</tal:comment>
<tr>
<tr valign="bottom">
<th tal:repeat="fieldInfo widget/fieldsd"
tal:content="python: _(fieldInfo[1]['labelId'])">
tal:content="structure python: _(fieldInfo[1]['labelId'])">
</th>
<tal:comment replace="nothing">Icon for adding a new row.</tal:comment>
<th tal:condition="isEdit">

View file

@ -23,7 +23,7 @@
cellspacing layout/cellspacing;
width layout/width;
align layout/align;
class python: tagCss and ('%s %s' % (tagCss, layoutCss)) or layoutCss;
class python: tagCss and ('%s %s' % (tagCss, layoutCss)).strip() or layoutCss;
style layout/style;
id tagId;
name tagId;">
@ -69,7 +69,8 @@
isMultiple python: (widget['multiplicity'][1] == None) or (widget['multiplicity'][1] &gt; 1);
masterCss python: widget['slaves'] and ('master_%s' % name) or '';
slaveCss python: widget['master'] and ('slave_%s_%s' % (widget['masterName'], '_'.join(widget['masterValue']))) or '';
tagCss tagCss | slaveCss;
tagCss tagCss | python:'';
tagCss python: ('%s %s' % (slaveCss, tagCss)).strip();
tagId python: widget['master'] and 'slave' or ''">
<metal:layout use-macro="here/skyn/widgets/show/macros/layout"/>
</metal:field>