Commit e8a1d995 authored by Jérome Perrin's avatar Jérome Perrin

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
parent 8c5657a9
......@@ -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():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment