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

View file

@ -2,15 +2,17 @@
<metal:view define-macro="view"> <metal:view define-macro="view">
<form name="executeAppyAction" <form name="executeAppyAction"
tal:define="formId python: '%s_%s' % (contextObj.UID(), name); tal:define="formId python: '%s_%s' % (contextObj.UID(), name);
label python: contextObj.translate(widget['labelId']); label python: contextObj.translate(widget['labelId'])"
labelConfirm python: contextObj.translate(widget['labelId'] + '_confirm')"
tal:attributes="id formId; action python: contextObj.absolute_url()+'/skyn/do'"> tal:attributes="id formId; action python: contextObj.absolute_url()+'/skyn/do'">
<input type="hidden" name="action" value="ExecuteAppyAction"/> <input type="hidden" name="action" value="ExecuteAppyAction"/>
<input type="hidden" name="objectUid" tal:attributes="value contextObj/UID"/> <input type="hidden" name="objectUid" tal:attributes="value contextObj/UID"/>
<input type="hidden" name="fieldName" tal:attributes="value name"/> <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; tal:attributes="value label;
onClick python: 'askConfirm(\'form\', \'%s\', &quot;%s&quot;)' % (formId, labelConfirm)"/> onClick python: 'askConfirm(\'form\', \'%s\', &quot;%s&quot;)' % (formId, labelConfirm)"/>
</tal:confirm>
<input type="submit" name="do" tal:condition="not: widget/confirm" <input type="submit" name="do" tal:condition="not: widget/confirm"
tal:attributes="value label" onClick="javascript:;"/> tal:attributes="value label" onClick="javascript:;"/>
<tal:comment replace="nothing">The previous onClick is simply used to prevent Plone <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; 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); atMostOneRef python: (multiplicity[1] == 1) and (len(objs)&lt;=1);
label python: contextObj.translate('label', field=appyType['name']); label python: contextObj.translate('label', field=appyType['name']);
addConfirmMsg python: tool.translate('%s_addConfirm' % appyType['labelId']); addConfirmMsg python: appyType['addConfirm'] and tool.translate('%s_addConfirm' % appyType['labelId']) or '';
description python: contextObj.translate('descr', field=appyType['name']);
navBaseCall python: 'askRefField(\'%s\',\'%s\',\'%s\',\'%s\',**v**)' % (ajaxHookId, contextObj.absolute_url(), fieldName, innerRef)"> 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. <tal:comment replace="nothing">This macro displays the Reference widget on a "consult" page.
@ -167,8 +166,8 @@
</legend> </legend>
<tal:comment replace="nothing">Object description</tal:comment> <tal:comment replace="nothing">Object description</tal:comment>
<!--p tal:condition="python: not innerRef and description.strip()" <p class="discreet" tal:condition="python: not innerRef and appyType['hasDescr']"
tal:content="description" class="discreet" ></p--> tal:content="python: contextObj.translate('descr', field=appyType['name'])"></p>
<tal:comment replace="nothing">Appy (top) navigation</tal:comment> <tal:comment replace="nothing">Appy (top) navigation</tal:comment>
<metal:nav use-macro="here/skyn/navigate/macros/appyNavigate"/> <metal:nav use-macro="here/skyn/navigate/macros/appyNavigate"/>

View file

@ -154,7 +154,7 @@
<th tal:repeat="colNb python:range(len(widget['columnsWidths']))" <th tal:repeat="colNb python:range(len(widget['columnsWidths']))"
tal:attributes="width python:widget['columnsWidths'][colNb]; tal:attributes="width python:widget['columnsWidths'][colNb];
align python:widget['columnsAligns'][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> </th>
</tr> </tr>
<tal:comment replace="nothing">The rows of widgets</tal:comment> <tal:comment replace="nothing">The rows of widgets</tal:comment>

View file

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