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): def getStorableValue(self, value):
'''Gets p_value in a form that can be stored in the database.''' '''Gets p_value in a form that can be stored in the database.'''
res = []
for v in value: for v in value:
sv = Object()
for name, field in self.fields: for name, field in self.fields:
setattr(v, name, field.getStorableValue(getattr(v, name))) setattr(sv, name, field.getStorableValue(getattr(v, name)))
return value res.append(sv)
return res
def getInnerValue(self, outerValue, name, i): def getInnerValue(self, outerValue, name, i):
'''Returns the value of inner field named p_name in row number p_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:condition="python: isEdit or value"
tal:attributes="id python: 'list_%s' % name"> tal:attributes="id python: 'list_%s' % name">
<tal:comment replace="nothing">Header</tal:comment> <tal:comment replace="nothing">Header</tal:comment>
<tr> <tr valign="bottom">
<th tal:repeat="fieldInfo widget/fieldsd" <th tal:repeat="fieldInfo widget/fieldsd"
tal:content="python: _(fieldInfo[1]['labelId'])"> tal:content="structure python: _(fieldInfo[1]['labelId'])">
</th> </th>
<tal:comment replace="nothing">Icon for adding a new row.</tal:comment> <tal:comment replace="nothing">Icon for adding a new row.</tal:comment>
<th tal:condition="isEdit"> <th tal:condition="isEdit">

View file

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