[Erp5-report] r19421 - in /erp5/trunk/bt5/erp5_forge: ActionTemplateItem/portal_types/porta...
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Feb 19 20:13:02 CET 2008
Author: yusei
Date: Tue Feb 19 20:13:01 2008
New Revision: 19421
URL: http://svn.erp5.org?rev=19421&view=rev
Log:
Add a script which collect message from entire system and export pot file.
Added:
erp5/trunk/bt5/erp5_forge/ActionTemplateItem/portal_types/portal_actions/
erp5/trunk/bt5/erp5_forge/ActionTemplateItem/portal_types/portal_actions/generate_pot_file.xml
erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_getActionTitleListFromAllActionProvider.xml
erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/ERP5Site_getToBeTranslatedMessageListFromEntireSystemAsPot.xml
Modified:
erp5/trunk/bt5/erp5_forge/ExtensionTemplateItem/Glossary.py
erp5/trunk/bt5/erp5_forge/bt/revision
erp5/trunk/bt5/erp5_forge/bt/template_action_path_list
Added: erp5/trunk/bt5/erp5_forge/ActionTemplateItem/portal_types/portal_actions/generate_pot_file.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_forge/ActionTemplateItem/portal_types/portal_actions/generate_pot_file.xml?rev=19421&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_forge/ActionTemplateItem/portal_types/portal_actions/generate_pot_file.xml (added)
+++ erp5/trunk/bt5/erp5_forge/ActionTemplateItem/portal_types/portal_actions/generate_pot_file.xml Tue Feb 19 20:13:01 2008
@@ -1,0 +1,83 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <tuple>
+ <global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
+ <tuple/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>__ac_local_roles__</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>action</string> </key>
+ <value>
+ <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+ </value>
+ </item>
+ <item>
+ <key> <string>category</string> </key>
+ <value> <string>global</string> </value>
+ </item>
+ <item>
+ <key> <string>condition</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>description</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>icon</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>generate_pot_file</string> </value>
+ </item>
+ <item>
+ <key> <string>permissions</string> </key>
+ <value>
+ <tuple>
+ <string>View management screens</string>
+ </tuple>
+ </value>
+ </item>
+ <item>
+ <key> <string>priority</string> </key>
+ <value> <float>20.0</float> </value>
+ </item>
+ <item>
+ <key> <string>title</string> </key>
+ <value> <string>Generate pot file</string> </value>
+ </item>
+ <item>
+ <key> <string>visible</string> </key>
+ <value> <int>1</int> </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+ <record id="2" aka="AAAAAAAAAAI=">
+ <pickle>
+ <tuple>
+ <global name="Expression" module="Products.CMFCore.Expression"/>
+ <tuple/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>text</string> </key>
+ <value> <string>string:${portal_url}/ERP5Site_getToBeTranslatedMessageListFromEntireSystemAsPot</string> </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Modified: erp5/trunk/bt5/erp5_forge/ExtensionTemplateItem/Glossary.py
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_forge/ExtensionTemplateItem/Glossary.py?rev=19421&r1=19420&r2=19421&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_forge/ExtensionTemplateItem/Glossary.py (original)
+++ erp5/trunk/bt5/erp5_forge/ExtensionTemplateItem/Glossary.py Tue Feb 19 20:13:01 2008
@@ -8,3 +8,22 @@
# we want to get only normal property.
result.append(i['id'])
return result
+
+
+def getActionTitleListFromAllActionProvider(portal):
+ result = {}
+ provider_list = []
+ for provider_id in portal.portal_actions.listActionProviders():
+ if provider_id in ('portal_types', 'portal_workflow'):
+ continue
+ provider = getattr(portal, provider_id, None)
+ if provider is None:
+ continue
+ provider_list.append(provider)
+
+ for typeinfo in portal.portal_types.objectValues():
+ provider_list.append(typeinfo)
+
+ for action in provider.listActions():
+ result[action.title] = None
+ return result.keys()
Added: erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_getActionTitleListFromAllActionProvider.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_getActionTitleListFromAllActionProvider.xml?rev=19421&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_getActionTitleListFromAllActionProvider.xml (added)
+++ erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/Base_getActionTitleListFromAllActionProvider.xml Tue Feb 19 20:13:01 2008
@@ -1,0 +1,37 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <tuple>
+ <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
+ <tuple/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>__ac_local_roles__</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_function</string> </key>
+ <value> <string>getActionTitleListFromAllActionProvider</string> </value>
+ </item>
+ <item>
+ <key> <string>_module</string> </key>
+ <value> <string>Glossary</string> </value>
+ </item>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>Base_getActionTitleListFromAllActionProvider</string> </value>
+ </item>
+ <item>
+ <key> <string>title</string> </key>
+ <value> <string></string> </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Added: erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/ERP5Site_getToBeTranslatedMessageListFromEntireSystemAsPot.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/ERP5Site_getToBeTranslatedMessageListFromEntireSystemAsPot.xml?rev=19421&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/ERP5Site_getToBeTranslatedMessageListFromEntireSystemAsPot.xml (added)
+++ erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/ERP5Site_getToBeTranslatedMessageListFromEntireSystemAsPot.xml Tue Feb 19 20:13:01 2008
@@ -1,0 +1,307 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <tuple>
+ <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+ <tuple/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>Python_magic</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>Script_magic</string> </key>
+ <value> <int>3</int> </value>
+ </item>
+ <item>
+ <key> <string>__ac_local_roles__</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_bind_names</string> </key>
+ <value>
+ <object>
+ <klass>
+ <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+ </klass>
+ <tuple/>
+ <state>
+ <dictionary>
+ <item>
+ <key> <string>_asgns</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>name_container</string> </key>
+ <value> <string>container</string> </value>
+ </item>
+ <item>
+ <key> <string>name_context</string> </key>
+ <value> <string>context</string> </value>
+ </item>
+ <item>
+ <key> <string>name_m_self</string> </key>
+ <value> <string>script</string> </value>
+ </item>
+ <item>
+ <key> <string>name_subpath</string> </key>
+ <value> <string>traverse_subpath</string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ </dictionary>
+ </state>
+ </object>
+ </value>
+ </item>
+ <item>
+ <key> <string>_body</string> </key>
+ <value> <string>message_dict = {}\n
+\n
+def add_message(message, comment):\n
+ if not message:\n
+ return\n
+ if message in message_dict:\n
+ comment_list = message_dict[message]\n
+ else:\n
+ comment_list = message_dict[message] = []\n
+ if comment not in comment_list:\n
+ comment_list.append(comment)\n
+\n
+portal_url = context.portal_url\n
+\n
+# Collect skin objects\n
+python_script_list = []\n
+form_list = []\n
+listbox_list = []\n
+zpt_list = []\n
+def iterate(obj):\n
+ for i in obj.objectValues():\n
+ if i.meta_type==\'Script (Python)\':\n
+ python_script_list.append(i)\n
+ elif i.meta_type==\'ERP5 Form\':\n
+ form_list.append(i)\n
+ elif i.meta_type==\'ListBox\' or i.id==\'listbox\':\n
+ listbox_list.append(i)\n
+ elif i.meta_type==\'Page Template\':\n
+ zpt_list.append(i)\n
+ if i.isPrincipiaFolderish:\n
+ iterate(i)\n
+iterate(context.portal_skins)\n
+\n
+\n
+#\n
+# Python Script\n
+#\n
+FUNC_NAME_LIST = (\'N_\',\n
+ \'Base_translateString\',\n
+ \'translateString\',\n
+ )\n
+\n
+for i in python_script_list:\n
+ source = i.body()\n
+ for func_name in FUNC_NAME_LIST:\n
+ call_func_name = \'%s(\' % func_name\n
+ if call_func_name in source:\n
+ for m in context.Base_getFunctionFirstArgumentValue(func_name, source):\n
+ add_message(m, portal_url.getRelativeContentURL(i))\n
+\n
+\n
+#\n
+# ERP5 Form title\n
+#\n
+for i in form_list:\n
+ add_message(i.title, portal_url.getRelativeContentURL(i))\n
+\n
+\n
+#\n
+# ListBox title, columns\n
+#\n
+for i in listbox_list:\n
+ add_message(i.title(), portal_url.getRelativeContentURL(i))\n
+ for value, label in i.get_value(\'columns\'):\n
+ add_message(label, portal_url.getRelativeContentURL(i))\n
+ for value, label in i.get_value(\'all_columns\'):\n
+ add_message(label, portal_url.getRelativeContentURL(i))\n
+\n
+#\n
+# ZPT\n
+#\n
+# TODO : To parse html and get static translated text.\n
+\n
+#\n
+# Workflow\n
+#\n
+for i in context.portal_workflow.objectValues():\n
+ if not i.states:\n
+ continue\n
+ for s in i.states.values():\n
+ if s.title:\n
+ add_message(s.title, portal_url.getRelativeContentURL(s))\n
+\n
+ if not i.transitions:\n
+ continue\n
+ for t in i.transitions.values():\n
+ if t.actbox_name:\n
+ add_message(t.actbox_name, portal_url.getRelativeContentURL(t))\n
+\n
+\n
+#\n
+# Portal Type\n
+#\n
+for i in context.portal_types.objectValues():\n
+ add_message(i.id, \'portal type\')\n
+\n
+\n
+#\n
+# Action\n
+#\n
+for action_title in context.Base_getActionTitleListFromAllActionProvider(context.getPortalObject()):\n
+ add_message(action_title, \'action\')\n
+\n
+\n
+#\n
+# Output\n
+#\n
+def format(string):\n
+ line_list = string.split(\'\\n\')\n
+ length = len(line_list)\n
+ if length==1:\n
+ return \'"%s"\' % string\n
+ else:\n
+ return \'\\n\'.join([\'""\']+[format(i) for i in line_list])\n
+\n
+\n
+MESSAGE_TEMPLATE = \'\'\'\\\n
+%s\n
+msgid %s\n
+msgstr ""\n
+\'\'\'\n
+message_list = message_dict.keys()\n
+message_list.sort()\n
+for message in message_list:\n
+ comment_list = message_dict[message]\n
+ comment = \'\\n\'.join([(\'#: %s\' % i) for i in comment_list])\n
+ print MESSAGE_TEMPLATE % (comment, format(message))\n
+\n
+context.REQUEST.RESPONSE.setHeader(\'Content-Type\', \'text/plain;charset=utf-8\')\n
+\n
+return printed\n
+</string> </value>
+ </item>
+ <item>
+ <key> <string>_code</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_filepath</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_owner</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_params</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>errors</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ <item>
+ <key> <string>func_code</string> </key>
+ <value>
+ <object>
+ <klass>
+ <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+ </klass>
+ <tuple/>
+ <state>
+ <dictionary>
+ <item>
+ <key> <string>co_argcount</string> </key>
+ <value> <int>0</int> </value>
+ </item>
+ <item>
+ <key> <string>co_varnames</string> </key>
+ <value>
+ <tuple>
+ <string>_print_</string>
+ <string>_print</string>
+ <string>message_dict</string>
+ <string>add_message</string>
+ <string>_getattr_</string>
+ <string>context</string>
+ <string>portal_url</string>
+ <string>python_script_list</string>
+ <string>form_list</string>
+ <string>listbox_list</string>
+ <string>zpt_list</string>
+ <string>iterate</string>
+ <string>FUNC_NAME_LIST</string>
+ <string>_getiter_</string>
+ <string>i</string>
+ <string>source</string>
+ <string>func_name</string>
+ <string>call_func_name</string>
+ <string>m</string>
+ <string>value</string>
+ <string>label</string>
+ <string>s</string>
+ <string>t</string>
+ <string>action_title</string>
+ <string>format</string>
+ <string>MESSAGE_TEMPLATE</string>
+ <string>message_list</string>
+ <string>message</string>
+ <string>_getitem_</string>
+ <string>comment_list</string>
+ <string>append</string>
+ <string>$append0</string>
+ <string>comment</string>
+ </tuple>
+ </value>
+ </item>
+ </dictionary>
+ </state>
+ </object>
+ </value>
+ </item>
+ <item>
+ <key> <string>func_defaults</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>ERP5Site_getToBeTranslatedMessageListFromEntireSystemAsPot</string> </value>
+ </item>
+ <item>
+ <key> <string>warnings</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Modified: erp5/trunk/bt5/erp5_forge/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_forge/bt/revision?rev=19421&r1=19420&r2=19421&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_forge/bt/revision (original)
+++ erp5/trunk/bt5/erp5_forge/bt/revision Tue Feb 19 20:13:01 2008
@@ -1,1 +1,1 @@
-205
+206
Modified: erp5/trunk/bt5/erp5_forge/bt/template_action_path_list
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_forge/bt/template_action_path_list?rev=19421&r1=19420&r2=19421&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_forge/bt/template_action_path_list (original)
+++ erp5/trunk/bt5/erp5_forge/bt/template_action_path_list Tue Feb 19 20:13:01 2008
@@ -17,4 +17,5 @@
Preference | subversion
Template Tool | bt_svn_history
Template Tool | search_portal_type
-Upload Module | view
+Upload Module | view
+portal_actions | generate_pot_file
More information about the Erp5-report
mailing list