Updated database upgrade code and removed INewLocalSite event subscriber
authorThierry Florac <tflorac@ulthar.net>
Sat, 10 Mar 2018 02:08:56 +0100
changeset 57 0f99462b4469
parent 56 d173b0fed8dc
child 58 7f1f4243b5b8
Updated database upgrade code and removed INewLocalSite event subscriber
src/pyams_scheduler/site.py
--- a/src/pyams_scheduler/site.py	Thu Mar 08 09:11:53 2018 +0100
+++ b/src/pyams_scheduler/site.py	Sat Mar 10 02:08:56 2018 +0100
@@ -18,29 +18,21 @@
 # import interfaces
 from pyams_scheduler.interfaces import IScheduler, SCHEDULER_NAME
 from pyams_utils.interfaces.site import ISiteGenerations
-from zope.site.interfaces import INewLocalSite
 
 # import packages
 from pyams_scheduler.scheduler import Scheduler
 from pyams_utils.registry import utility_config
 from pyams_utils.site import check_required_utilities
-from pyramid.events import subscriber
 
 
 REQUIRED_UTILITIES = ((IScheduler, '', Scheduler, SCHEDULER_NAME), )
 
 
-@subscriber(INewLocalSite)
-def handle_new_local_site(event):
-    """Create a new scheduler when a site is created"""
-    site = event.manager.__parent__
-    check_required_utilities(site, REQUIRED_UTILITIES)
-
-
 @utility_config(name='PyAMS scheduler', provides=ISiteGenerations)
 class SchedulerGenerationsChecker(object):
     """Scheduler generations checker"""
 
+    order = 50
     generation = 1
 
     def evolve(self, site, current=None):