From 27a662787087362ee1a2d8dd9db9a9fb1eb8010b Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Thu, 25 Sep 2008 15:44:18 +0000
Subject: [PATCH] * optimise TALES (use STRING expression or PATH expression
 instead of PYTHON expression if possible).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23828 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_xhtml_style/context_box_render.xml   | 34 +++++++++----------
 .../developper_shortcut_render.xml            | 28 +++++++--------
 .../erp5_xhtml_style/field_render.xml         |  2 +-
 .../erp5_xhtml_style/form_dialog.xml          |  2 +-
 .../erp5_xhtml_style/form_render.xml          |  2 +-
 .../template_erp5_xhtml_style.xml             |  6 ++--
 .../bootstrap/erp5_xhtml_style/bt/revision    |  2 +-
 7 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/context_box_render.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/context_box_render.xml
index 38ab0ec443..dbc57331ba 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/context_box_render.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/context_box_render.xml
@@ -56,13 +56,13 @@
           <tal:block tal:condition="python: here.getPortalTypeName() in portal.portal_types.objectIds() and portal.portal_types.getTypeInfo(here).Base_getSourceVisibility()">\n
             <option value="1" disabled="disabled" i18n:translate="" i18n:domain="ui">-- Developper Mode --</option>\n
             <option tal:attributes="value python: \'%s/manage_workspace\' % (here.portal_types.getTypeInfo(here).absolute_url(),)"\n
-                    i18n:translate="" i18n:domain="ui">Edit Portal Type \'<tal:block tal:content="python: here.getPortalTypeName()"\n
+                    i18n:translate="" i18n:domain="ui">Edit Portal Type \'<tal:block tal:content="here/getPortalTypeName"\n
                                            i18n:name="portal_type" i18n:translate="" i18n:domain="ui" />\'</option>\n
           </tal:block>\n
           <tal:block tal:condition="portal/portal_workflow/Base_getSourceVisibility">\n
             <option value="1" disabled="disabled" i18n:translate="" i18n:domain="ui">-- Workflows --</option>\n
             <tal:block tal:repeat="workflow python: portal.portal_workflow.getWorkflowsFor(here)">\n
-              <option tal:attributes="value python: \'%s/manage_properties\' % (workflow.absolute_url(), )" tal:content="workflow/title" />\n
+              <option tal:attributes="value string:${workflow/absolute_url}/manage_properties" tal:content="workflow/title" />\n
             </tal:block>\n
           </tal:block>\n
         </tal:block>\n
@@ -84,7 +84,7 @@
                 i18n:translate="" i18n:domain="ui">Action...</option>\n
         <tal:block tal:define="allowed_content_type_list here/getVisibleAllowedContentTypeList | python:[]">\n
           <tal:block tal:repeat="content_id allowed_content_type_list">\n
-            <option tal:attributes="value python: \'add %s\' % (content_id, )"\n
+            <option tal:attributes="value string:add $content_id"\n
                     i18n:translate="" i18n:domain="ui">Add <tal:block tal:content="content_id"\n
                              i18n:name="portal_type" i18n:translate="" i18n:domain="ui" /></option>\n
           </tal:block>\n
@@ -97,7 +97,7 @@
                    tal:condition="document_template_list">\n
           <option disabled="disabled">-- <tal:block i18n:translate="" i18n:domain="ui">Templates</tal:block> --</option>\n
           <tal:block tal:repeat="document_template document_template_list">\n
-            <option tal:attributes="value python:\'template %s\' % (document_template.getRelativeUrl(), )"\n
+            <option tal:attributes="value string:template ${document_template/getRelativeUrl}"\n
                     i18n:translate="" i18n:domain="ui">Add <tal:block tal:content="document_template/getTitle"\n
                              i18n:name="document_template" /></option>\n
           </tal:block>\n
@@ -105,13 +105,13 @@
         <option disabled="disabled">-- <tal:block i18n:translate="" i18n:domain="ui">Workflows</tal:block> --</option>\n
         <tal:block tal:repeat="action actions/workflow">\n
           <option tal:content="action/name"\n
-                  tal:attributes="value python: \'workflow %s\' % (action[\'url\'], )"\n
+                  tal:attributes="value string:workflow ${action/url}"\n
                   i18n:translate="" i18n:domain="ui" />\n
         </tal:block>\n
         <option disabled="disabled">-- <tal:block i18n:translate="" i18n:domain="ui">Object</tal:block> --</option>\n
         <tal:block tal:repeat="action actions/object_action | nothing">\n
           <option tal:content="action/name"\n
-                  tal:attributes="value python: \'object %s\' % (action[\'url\'], )"\n
+                  tal:attributes="value string:object ${action/url}"\n
                   i18n:translate="" i18n:domain="ui" />\n
         </tal:block>\n
         <tal:block tal:define="object_view_list actions/object_view|nothing;\n
@@ -119,7 +119,7 @@
                    tal:condition="module_view_list">\n
           <tal:block tal:repeat="action module_view_list">\n
             <option tal:content="action/name"\n
-                    tal:attributes="value python: \'object %s\' % (action[\'url\'],)"\n
+                    tal:attributes="value string:object ${action/url}"\n
                     i18n:translate="" i18n:domain="ui" />\n
           </tal:block>\n
         </tal:block>\n
@@ -128,7 +128,7 @@
           <option disabled="disabled">-- <tal:block i18n:translate="" i18n:domain="ui">Folder</tal:block> --</option>\n
           <tal:block tal:repeat="action actions/folder">\n
             <option tal:content="action/name"\n
-                    tal:attributes="value python: \'folder %s\' % (action[\'url\'], )"\n
+                    tal:attributes="value string:folder ${action/url}"\n
                     i18n:translate="" i18n:domain="ui" />\n
           </tal:block>\n
         </tal:block>\n
@@ -185,8 +185,8 @@
           <span class="description" i18n:translate="" i18n:domain="ui">New</span>\n
         </button>\n
         <button class="clone" type="submit" title="Clone"\n
-                tal:condition="python: not list_mode"\n
-                tal:attributes="name python: \'Base_createCloneDocument:method\'"\n
+                tal:condition="not: list_mode"\n
+                tal:attributes="name string:Base_createCloneDocument:method"\n
                 i18n:attributes="title" i18n:domain="ui">\n
           <span class="image"></span>\n
           <span class="description" i18n:translate="" i18n:domain="ui">Clone</span>\n
@@ -200,13 +200,13 @@
           <tal:block tal:condition="request/selection_index | nothing">\n
             <span class="separator"><!--separator--></span>\n
             <a class="jump_first" title="First"\n
-               tal:attributes="href python: \'portal_selections/viewFirst?%s\' % (http_parameters, )"\n
+               tal:attributes="href string:portal_selections/viewFirst?$http_parameters"\n
                i18n:attributes="title" i18n:domain="ui">\n
               <span class="image"></span>\n
               <span class="description" i18n:translate="" i18n:domain="ui">First</span>\n
             </a>\n
             <a class="jump_previous" title="Previous"\n
-               tal:attributes="href python: \'portal_selections/viewPrevious?%s\' % (http_parameters, )"\n
+               tal:attributes="href string:portal_selections/viewPrevious?$http_parameters"\n
                i18n:attributes="title" i18n:domain="ui">\n
               <span class="image"></span>\n
               <span class="description" i18n:translate="" i18n:domain="ui">Previous</span>\n
@@ -217,13 +217,13 @@
               <span class="description" i18n:translate="" i18n:domain="ui">List Mode</span>\n
             </a>\n
             <a class="jump_next" title="Next"\n
-               tal:attributes="href python: \'portal_selections/viewNext?%s\' % (http_parameters, )"\n
+               tal:attributes="href string:portal_selections/viewNext?$http_parameters"\n
                i18n:attributes="title" i18n:domain="ui">\n
               <span class="image"></span>\n
               <span class="description" i18n:translate="" i18n:domain="ui">Next</span>\n
             </a>\n
             <a class="jump_last" title="Last"\n
-               tal:attributes="href python: \'portal_selections/viewLast?%s\' % (http_parameters, )"\n
+               tal:attributes="href string:portal_selections/viewLast?$http_parameters"\n
                i18n:attributes="title" i18n:domain="ui">\n
               <span class="image"></span>\n
               <span class="description" i18n:translate="" i18n:domain="ui">Last</span>\n
@@ -280,9 +280,9 @@
           <tal:block tal:repeat="button_action button_actions">\n
             <a tal:attributes="href python: \'%s%s%s\' % (button_action[\'url\'], \'?\' in button_action[\'url\'] and \'&amp;\' or \'?\', http_parameters)">\n
               <img i18n:attributes="title" i18n:domain="ui"\n
-                   tal:attributes="src python:button_action[\'icon\'];\n
-                   title python:button_action[\'name\'];\n
-                   alt python:button_action[\'name\']" />\n
+                   tal:attributes="src button_action/icon;\n
+                   title button_action/name;\n
+                   alt button_action/name" />\n
             </a>\n
           </tal:block>\n
         </tal:block>\n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/developper_shortcut_render.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/developper_shortcut_render.xml
index a57113928b..d737f6bc15 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/developper_shortcut_render.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/developper_shortcut_render.xml
@@ -45,23 +45,23 @@
   <tal:block metal:define-macro="edit_link">\n
     <a tabindex="1000" tal:condition="python: (getattr(object, \'meta_type\', None) is not None) and (getattr(object, \'getPortalObject\', None) is not None)"\n
        tal:attributes="href python: \'%s/manage_main\' % (\'/\'.join(object.getPhysicalPath()[len(object.getPortalObject().getPhysicalPath()):])) # XXX: quick hack to get path;\n
-       title info;"><img tal:attributes="src python: \'%s/images/%s\' % (portal_path, image);\n
+       title info;"><img tal:attributes="src string:$portal_path/images/$image;\n
                          alt info;" /></a>\n
   </tal:block>\n
   <tal:block metal:define-macro="translate_link">\n
     <a tabindex="1000" tal:define="image image | python: \'translate.png\'"\n
        tal:attributes="href python: \'%s/manage_messages?regex=^%s%%24&amp;lang=%s\' % (\'/\'.join(here.Localizer.erp5_ui.getPhysicalPath()[len(here.Localizer.erp5_ui.getPortalObject().getPhysicalPath()):]), message.replace(\'(\', \'\\(\').replace(\')\', \'\\)\'), selected_language);\n
-       title info;"><img tal:attributes="src python: \'%s/images/%s\' % (portal_path, image);\n
+       title info;"><img tal:attributes="src string:$portal_path/images/$image;\n
                          alt info;" /></a>\n
   </tal:block>\n
   <tal:block metal:define-macro="form">\n
-    <tal:block tal:define="image python: \'editform.png\';\n
-               info python: \'Edit this form\';\n
+    <tal:block tal:define="image string:editform.png;\n
+               info string:Edit this form;\n
                object nocall: form;">\n
       <tal:block metal:use-macro="developper_shortcut_render/macros/edit_link" />\n
     </tal:block>\n
-    <tal:block tal:define="image python: \'editformaction.png\';\n
-               info python: \'Edit this form\\\'s action\';\n
+    <tal:block tal:define="image string:editformaction.png;\n
+               info string:Edit this form\'s action;\n
                object python: getattr(here, form.action, None);">\n
       <tal:block metal:use-macro="developper_shortcut_render/macros/edit_link" />\n
       <div class="clear">\n
@@ -69,23 +69,23 @@
     </tal:block>\n
   </tal:block>\n
   <tal:block metal:define-macro="field_developper">\n
-    <tal:block tal:define="image python: \'editfield.png\';\n
-               info python: \'Edit this field\';\n
+    <tal:block tal:define="image string:editfield.png;\n
+               info string:Edit this field;\n
                object nocall: field;">\n
       <tal:block metal:use-macro="developper_shortcut_render/macros/edit_link" />\n
     </tal:block>\n
   </tal:block>\n
   <tal:block metal:define-macro="field_translator">\n
-    <tal:block tal:define="info python: \'Translate this field title\';\n
-               message python: field[\'title\'];\n
-               image python: \'translate.png\'">\n
+    <tal:block tal:define="info string:Translate this field title;\n
+               message field/title;\n
+               image string:translate.png">\n
       <tal:block metal:use-macro="developper_shortcut_render/macros/translate_link" />\n
     </tal:block>\n
     <tal:block tal:condition="field_description | nothing">\n
       <tal:block tal:define="message field_description;\n
-                 info python: \'Translate this field description\';\n
-                 image python: \'translate_tooltip.png\'"\n
-                 tal:condition="python: message not in (None, \'\')">\n
+                 info string:Translate this field description;\n
+                 image string:translate_tooltip.png"\n
+                 tal:condition="message | nothing">\n
         <tal:block metal:use-macro="developper_shortcut_render/macros/translate_link" />\n
       </tal:block>\n
     </tal:block>\n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/field_render.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/field_render.xml
index 43d36cd2e7..f67613dad4 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/field_render.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/field_render.xml
@@ -68,7 +68,7 @@
             </tal:block>\n
           </label>\n
           <div class="input" tal:content="structure python: html_tuple[1]" />\n
-          <span tal:condition="python: field_has_error"\n
+          <span tal:condition="field_has_error"\n
                 class="error"\n
                 tal:content="python: field_errors[field_id].error_text"\n
                 i18n:translate="" i18n:domain="ui" />\n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/form_dialog.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/form_dialog.xml
index 3223502159..ec1d61dc43 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/form_dialog.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/form_dialog.xml
@@ -87,7 +87,7 @@
 \n
           <tal:block metal:define-macro="content">\n
             <div class="content"\n
-                 tal:define="group_list python: form.Form_getGroupTitleAndId();\n
+                 tal:define="group_list form/Form_getGroupTitleAndId;\n
                  gid_list   python: \' \'.join([x[\'gid\'] for x in group_list if x not in (\'bottom\', \'hidden\')]);">\n
               <tal:block tal:repeat="group group_list">\n
                 <tal:block tal:define="gid    group/gid">\n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/form_render.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/form_render.xml
index bf7d99d6ba..4d4a7074f6 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/form_render.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/form_render.xml
@@ -71,7 +71,7 @@ It is possible to specify a group id and a group title by naming a group followi
     <tal:block\n
               tal:define="field_errors python: request.get(\'field_errors\', {});\n
               dummy        python: request.set(\'here\', here);\n
-              group_list   python: form.Form_getGroupTitleAndId();\n
+              group_list   form/Form_getGroupTitleAndId;\n
               gid_list     python: \' \'.join([x[\'gid\'] for x in group_list if x!=\'hidden\']);\n
               field_render nocall: here/field_render/macros/field_render">\n
       <tal:block tal:condition="preferred_html_style_developper_mode">\n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/template_erp5_xhtml_style.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/template_erp5_xhtml_style.xml
index 599835e29c..096e62e2cb 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/template_erp5_xhtml_style.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/template_erp5_xhtml_style.xml
@@ -75,7 +75,7 @@ IDEAS:\n
                 <tal:block tal:define="css python: field.render_css(REQUEST=request)">\n
                   <style tal:condition="python: css is not None"\n
                          tal:content="css"\n
-                         tal:attributes="type python:\'text/css\'">\n
+                         tal:attributes="type string:text/css">\n
                   </style>\n
                 </tal:block>\n
                 <tal:block tal:define="dummy python: css_list.extend(field.get_css_list(REQUEST=request))" />\n
@@ -83,10 +83,10 @@ IDEAS:\n
               </tal:block>\n
             </tal:block>\n
           </tal:block>\n
-          <tal:block tal:repeat="css python: css_list">\n
+          <tal:block tal:repeat="css css_list">\n
             <link tal:attributes="href css" type="text/css" rel="stylesheet" />\n
           </tal:block>\n
-          <tal:block tal:repeat="js python: js_list">\n
+          <tal:block tal:repeat="js js_list">\n
             <script tal:attributes="src js" type="text/javascript"></script>\n
           </tal:block>\n
           <link rel="icon" tal:attributes="href string:${portal_path}/favicon.ico" type="image/x-icon" />\n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
index e1f27603b6..3be613f062 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
@@ -1 +1 @@
-613
\ No newline at end of file
+614
\ No newline at end of file
-- 
2.30.9