From eda5912eca2c4dd402b3b46ac7569ea5b75faafd Mon Sep 17 00:00:00 2001 From: Yusei Tahara <yusei@nexedi.com> Date: Wed, 12 Dec 2007 14:46:10 +0000 Subject: [PATCH] Display error message when exception is raised. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18268 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_dms/Document_getPreviewAsHTML.xml | 156 ++++++++++++++++++ .../html_representation.xml | 20 +-- bt5/erp5_dms/bt/revision | 2 +- 3 files changed, 166 insertions(+), 12 deletions(-) create mode 100644 bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_getPreviewAsHTML.xml diff --git a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_getPreviewAsHTML.xml b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_getPreviewAsHTML.xml new file mode 100644 index 0000000000..ab4e5083f4 --- /dev/null +++ b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_getPreviewAsHTML.xml @@ -0,0 +1,156 @@ +<?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 encoding="cdata"><![CDATA[ + +try:\n + return context.asStrippedHTML()\n +except Exception, e:\n + from Products.ERP5Type.Log import log\n + log("asStrippedHTML", str(e))\n + error_message = context.Base_translateString("Preview Error.")\n + return \'<div class="error">%s</div>\' % error_message\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>_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>_getattr_</string> +<string>context</string> + <string>Exception</string> + <string>e</string> + <string>Products.ERP5Type.Log</string> + <string>log</string> + <string>str</string> + <string>error_message</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>Document_getPreviewAsHTML</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_viewHTMLPreview/html_representation.xml b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_viewHTMLPreview/html_representation.xml index 0feeae9c15..05c22d1f12 100644 --- a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_viewHTMLPreview/html_representation.xml +++ b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_viewHTMLPreview/html_representation.xml @@ -3,11 +3,8 @@ <record id="1" aka="AAAAAAAAAAE="> <pickle> <tuple> - <tuple> - <string>Products.ERP5Form.EditorField</string> - <string>EditorField</string> - </tuple> - <none/> + <global name="EditorField" module="Products.ERP5Form.EditorField"/> + <tuple/> </tuple> </pickle> <pickle> @@ -184,6 +181,10 @@ <key> <string>required</string> </key> <value> <string></string> </value> </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string></string> </value> + </item> <item> <key> <string>title</string> </key> <value> <string></string> </value> @@ -292,18 +293,15 @@ <record id="2" aka="AAAAAAAAAAI="> <pickle> <tuple> - <tuple> - <string>Products.Formulator.TALESField</string> - <string>TALESMethod</string> - </tuple> - <none/> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + <tuple/> </tuple> </pickle> <pickle> <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>here/asStrippedHTML</string> </value> + <value> <string>here/Document_getPreviewAsHTML</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_dms/bt/revision b/bt5/erp5_dms/bt/revision index d6ee760bad..475fbacb43 100644 --- a/bt5/erp5_dms/bt/revision +++ b/bt5/erp5_dms/bt/revision @@ -1 +1 @@ -762 \ No newline at end of file +763 \ No newline at end of file -- 2.30.9