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,11 +106,9 @@ class AlarmTool(BaseTool): ...@@ -106,11 +106,9 @@ class AlarmTool(BaseTool):
""" """
We retrieve thanks to the catalog the full list of alarms We retrieve thanks to the catalog the full list of alarms
""" """
user = self.portal_catalog.getOwner()
newSecurityManager(self.REQUEST, user)
if to_active: if to_active:
now = DateTime() now = DateTime()
catalog_search = self.portal_catalog( catalog_search = self.portal_catalog.unrestrictedSearchResults(
portal_type = self.getPortalAlarmTypeList(), portal_type = self.getPortalAlarmTypeList(),
alarm_date={'query':now,'range':'ngt'} alarm_date={'query':now,'range':'ngt'}
) )
...@@ -118,7 +116,7 @@ class AlarmTool(BaseTool): ...@@ -118,7 +116,7 @@ class AlarmTool(BaseTool):
alarm_list = [x.getObject() for x in catalog_search \ alarm_list = [x.getObject() for x in catalog_search \
if x.getObject().getAlarmDate()<=now] if x.getObject().getAlarmDate()<=now]
else: else:
catalog_search = self.portal_catalog( catalog_search = self.portal_catalog.unrestrictedSearchResults(
portal_type = self.getPortalAlarmTypeList() portal_type = self.getPortalAlarmTypeList()
) )
alarm_list = [x.getObject() for x in catalog_search] alarm_list = [x.getObject() for x in catalog_search]
...@@ -132,7 +130,7 @@ class AlarmTool(BaseTool): ...@@ -132,7 +130,7 @@ class AlarmTool(BaseTool):
""" """
current_date = DateTime() current_date = DateTime()
for alarm in self.getAlarmList(to_active=1): for alarm in self.getAlarmList(to_active=1):
if alarm: if alarm is not None:
user = alarm.getOwner() user = alarm.getOwner()
newSecurityManager(self.REQUEST, user) newSecurityManager(self.REQUEST, user)
if alarm.isActive() or not alarm.isEnabled(): 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