[Erp5-report] r24787 - /erp5/trunk/products/ERP5Type/patches/WorkflowTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Dec 4 11:01:55 CET 2008


Author: jm
Date: Thu Dec  4 11:01:51 2008
New Revision: 24787

URL: http://svn.erp5.org?rev=24787&view=rev
Log:
Ignore Unauthorized exceptions when evaluating worklists as anonymous user.

Modified:
    erp5/trunk/products/ERP5Type/patches/WorkflowTool.py

Modified: erp5/trunk/products/ERP5Type/patches/WorkflowTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/WorkflowTool.py?rev=24787&r1=24786&r2=24787&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/WorkflowTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/patches/WorkflowTool.py [utf8] Thu Dec  4 11:01:51 2008
@@ -12,6 +12,7 @@
 #
 ##############################################################################
 
+import sys
 from zLOG import LOG, WARNING
 from types import StringTypes
 
@@ -446,6 +447,7 @@
           worklist_dict[wf_id] = a
 
   if len(worklist_dict):
+    is_anonymous = getToolByName(self, 'portal_membership').isAnonymousUser()
     portal_url = getToolByName(self, 'portal_url')()
     portal_catalog = getToolByName(self, 'portal_catalog')
     search_result = getattr(self, "Base_getCountFromWorklistTable", None)
@@ -509,11 +511,20 @@
         group_by_expression = ', '.join(total_criterion_id_list)
         assert COUNT_COLUMN_TITLE not in total_criterion_id_list
         select_expression = ', '.join(select_expression)
-        catalog_brain_result = search_result(select_expression=select_expression,
-                                             group_by_expression=group_by_expression,
-                                             query=query,
-                                             limit=None,
-                                             src__=src__)
+        try:
+          catalog_brain_result = search_result(
+                                      select_expression=select_expression,
+                                      group_by_expression=group_by_expression,
+                                      query=query,
+                                      limit=None,
+                                      src__=src__)
+        except Unauthorized:
+          if not is_anonymous:
+            raise
+          LOG('WorkflowTool.listActions', WARNING,
+              'Exception while computing worklists: %s'
+              % grouped_worklist_dict,
+              error=sys.exc_info())
         if src__:
           action_list.append(catalog_brain_result)
         else:




More information about the Erp5-report mailing list