From e8a1d995ae50cceabd8ed038101416c3fc2f1bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Wed, 28 Mar 2007 08:25:01 +0000 Subject: [PATCH] use unrestrictedSearchResults instead of changing the security manager. do not use 'if obj' git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13735 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Tool/AlarmTool.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/product/ERP5/Tool/AlarmTool.py b/product/ERP5/Tool/AlarmTool.py index 9fd38815ae..ce8edd2f3c 100644 --- a/product/ERP5/Tool/AlarmTool.py +++ b/product/ERP5/Tool/AlarmTool.py @@ -106,19 +106,17 @@ class AlarmTool(BaseTool): """ We retrieve thanks to the catalog the full list of alarms """ - user = self.portal_catalog.getOwner() - newSecurityManager(self.REQUEST, user) if to_active: now = DateTime() - catalog_search = self.portal_catalog( - portal_type = self.getPortalAlarmTypeList(), + catalog_search = self.portal_catalog.unrestrictedSearchResults( + portal_type = self.getPortalAlarmTypeList(), alarm_date={'query':now,'range':'ngt'} ) # check again the alarm date in case the alarm was not yet reindexed alarm_list = [x.getObject() for x in catalog_search \ if x.getObject().getAlarmDate()<=now] else: - catalog_search = self.portal_catalog( + catalog_search = self.portal_catalog.unrestrictedSearchResults( portal_type = self.getPortalAlarmTypeList() ) alarm_list = [x.getObject() for x in catalog_search] @@ -132,7 +130,7 @@ class AlarmTool(BaseTool): """ current_date = DateTime() for alarm in self.getAlarmList(to_active=1): - if alarm: + if alarm is not None: user = alarm.getOwner() newSecurityManager(self.REQUEST, user) if alarm.isActive() or not alarm.isEnabled(): -- 2.30.9