appy.gen: removed from some pages superfluous translations of inexistent labels.

This commit is contained in:
Gaetan Delannay 2011-09-07 09:56:53 +02:00
parent b9c6283d9e
commit d2d3f9a745
5 changed files with 25 additions and 21 deletions

View file

@ -7,8 +7,9 @@
startNumber request/startNumber|python:'0';
startNumber python: int(startNumber);
searchName request/search;
searchLabel python: test(searchName=='_advanced', 'search_results', '%s_search_%s' % (contentType, searchName));
searchDescr python: '%s_descr' % searchLabel;
labelId python: searchName and ('%s_search_%s' % (contentType, searchName)) or '';
labelId python: (searchName == '_advanced') and 'search_results' or labelId;
searchLabel python: labelId and tool.translate(labelId) or '';
severalTypes python: contentType and (contentType.find(',') != -1);
sortKey request/sortKey| python:'';
sortOrder request/sortOrder| python:'asc';
@ -26,7 +27,7 @@
<fieldset>
<legend>
<span tal:replace="structure python: test(searchName, tool.translate(searchLabel), test(severalTypes, tool.translate(tool.getAppName()), tool.translate('%s_plural' % contentType)))"/>
<span tal:replace="structure python: test(searchName, searchLabel, test(severalTypes, tool.translate(tool.getAppName()), tool.translate('%s_plural' % contentType)))"/>
(<span tal:replace="totalNumber"/>)
<tal:newSearch condition="python: searchName == '_advanced'">
&nbsp;&nbsp;—&nbsp;&nbsp;<i><a tal:attributes="href newSearchUrl"
@ -45,16 +46,20 @@
</td></tr>
</table>
<table cellpadding="0" cellspacing="0" width="100%"><tr>
<td tal:define="descr python: tool.translate(searchDescr)"
tal:condition="python: searchName and descr.strip()">
<span class="discreet" tal:content="descr"></span><br/><br/>
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<tal:descr condition="searchName">
<td tal:define="descr python: tool.translate('%s_descr' % labelId)"
tal:condition="descr/strip">
<span class="discreet" tal:content="descr"></span><br/><br/>
</td>
</tal:descr>
<td align="right" width="25%">
<tal:comment replace="nothing">Appy (top) navigation</tal:comment>
<metal:nav use-macro="here/skyn/navigate/macros/appyNavigate"/>
<tal:comment replace="nothing">Appy (top) navigation</tal:comment>
<metal:nav use-macro="here/skyn/navigate/macros/appyNavigate"/>
</td>
</tr></table>
</tr>
</table>
<table tal:define="fieldNames python: tool.getResultColumnsNames(contentType, refField);
widgets python: objs[0].getAppyTypesFromNames(fieldNames);"

View file

@ -2,15 +2,17 @@
<metal:view define-macro="view">
<form name="executeAppyAction"
tal:define="formId python: '%s_%s' % (contextObj.UID(), name);
label python: contextObj.translate(widget['labelId']);
labelConfirm python: contextObj.translate(widget['labelId'] + '_confirm')"
label python: contextObj.translate(widget['labelId'])"
tal:attributes="id formId; action python: contextObj.absolute_url()+'/skyn/do'">
<input type="hidden" name="action" value="ExecuteAppyAction"/>
<input type="hidden" name="objectUid" tal:attributes="value contextObj/UID"/>
<input type="hidden" name="fieldName" tal:attributes="value name"/>
<input type="button" tal:condition="widget/confirm"
<tal:confirm condition="widget/confirm">
<input type="button"
tal:define="labelConfirm python: contextObj.translate(widget['labelId'] + '_confirm')"
tal:attributes="value label;
onClick python: 'askConfirm(\'form\', \'%s\', &quot;%s&quot;)' % (formId, labelConfirm)"/>
</tal:confirm>
<input type="submit" name="do" tal:condition="not: widget/confirm"
tal:attributes="value label" onClick="javascript:;"/>
<tal:comment replace="nothing">The previous onClick is simply used to prevent Plone

View file

@ -121,8 +121,7 @@
showPlusIcon python:not appyType['isBack'] and appyType['add'] and not maxReached and member.has_permission(addPermission, folder) and canWrite;
atMostOneRef python: (multiplicity[1] == 1) and (len(objs)&lt;=1);
label python: contextObj.translate('label', field=appyType['name']);
addConfirmMsg python: tool.translate('%s_addConfirm' % appyType['labelId']);
description python: contextObj.translate('descr', field=appyType['name']);
addConfirmMsg python: appyType['addConfirm'] and tool.translate('%s_addConfirm' % appyType['labelId']) or '';
navBaseCall python: 'askRefField(\'%s\',\'%s\',\'%s\',\'%s\',**v**)' % (ajaxHookId, contextObj.absolute_url(), fieldName, innerRef)">
<tal:comment replace="nothing">This macro displays the Reference widget on a "consult" page.
@ -167,8 +166,8 @@
</legend>
<tal:comment replace="nothing">Object description</tal:comment>
<!--p tal:condition="python: not innerRef and description.strip()"
tal:content="description" class="discreet" ></p-->
<p class="discreet" tal:condition="python: not innerRef and appyType['hasDescr']"
tal:content="python: contextObj.translate('descr', field=appyType['name'])"></p>
<tal:comment replace="nothing">Appy (top) navigation</tal:comment>
<metal:nav use-macro="here/skyn/navigate/macros/appyNavigate"/>

View file

@ -154,7 +154,7 @@
<th tal:repeat="colNb python:range(len(widget['columnsWidths']))"
tal:attributes="width python:widget['columnsWidths'][colNb];
align python:widget['columnsAligns'][colNb]"
tal:content="structure python: test(widget['hasHeaders'], contextObj.translate('%s_col%d' % (widget['labelId'], colNb+1)), '')">
tal:content="structure python: widget['hasHeaders'] and contextObj.translate('%s_col%d' % (widget['labelId'], colNb+1)) or ''">
</th>
</tr>
<tal:comment replace="nothing">The rows of widgets</tal:comment>

View file

@ -62,9 +62,7 @@ class AbstractWrapper(object):
except AttributeError, ae:
# Maybe a back reference?
res = self.o.getAppyType(name)
if not res:
print "Attribute error", ae
raise ae
if not res: raise ae
# If we got an Appy type, return the value of this type for this object
if isinstance(res, Type):
o = self.o