[Erp5-report] r21269 - in /erp5/trunk/products/ERP5/bootstrap/erp5_core: SkinTemplateItem/p...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jun 2 17:16:11 CEST 2008


Author: romain
Date: Mon Jun  2 17:16:10 2008
New Revision: 21269

URL: http://svn.erp5.org?rev=21269&view=rev
Log:
Catch Unauthorized exception which may be raised by index_html (through checkConversionFormatPermission script), and return a nicer message to the user.

Modified:
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_download.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_download.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_download.xml?rev=21269&r1=21268&r2=21269&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_download.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_download.xml Mon Jun  2 17:16:10 2008
@@ -3,11 +3,8 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Products.PythonScripts.PythonScript</string>
-          <string>PythonScript</string>
-        </tuple>
-        <none/>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
@@ -71,6 +68,14 @@
             <value> <string>request = container.REQUEST\n
 response = request.RESPONSE\n
 \n
+from zExceptions import Unauthorized\n
+\n
+try:\n
+  result = context.index_html(request, response)\n
+except Unauthorized:\n
+  msg = context.Base_translateString("You don\'t have enough permission for converting this document.")\n
+  return context.Base_redirect(keep_items=dict(portal_status_message=msg))\n
+\n
 if hasattr(context,\'getContentType\'):\n
   response.setHeader(\'Content-type\', context.getContentType())\n
 else:\n
@@ -78,7 +83,8 @@
 \n
 file_name = context.getSourceReference() or context.getTitle() or context.getId()\n
 response.setHeader(\'Content-disposition\', \'attachment; filename="%s"\' % file_name)\n
-return context.index_html(request, response)\n
+\n
+return result\n
 </string> </value>
         </item>
         <item>
@@ -125,8 +131,13 @@
                             <string>container</string>
                             <string>request</string>
                             <string>response</string>
+                            <string>zExceptions</string>
+                            <string>Unauthorized</string>
+                            <string>context</string>
+                            <string>result</string>
+                            <string>msg</string>
+                            <string>dict</string>
                             <string>hasattr</string>
-                            <string>context</string>
                             <string>file_name</string>
                           </tuple>
                         </value>

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision?rev=21269&r1=21268&r2=21269&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision Mon Jun  2 17:16:10 2008
@@ -1,1 +1,1 @@
-826
+827




More information about the Erp5-report mailing list