예제 #1
0
 def start (self):
     """Configure your app in the start phase."""
     if not self.bootstrapped:
         # initialize the forms app for registration
         self._form_app = self.router.get_app("form")
         # this tells the form app to add itself as a message handler
         # which registers the regex and function that this will dispatch to
         self._form_app.add_message_handler_to(self)
         
         formslogic = WeltelFormsLogic()
         formslogic.app = self
         # this tells the form app that this is also a form handler 
         self._form_app.add_form_handler("weltel", formslogic)
         
         self.boostrapped = True
         
         # we could also put this in the fixture
         # set up automatic deregistration event
         try:
             EventSchedule.objects.get(callback="weltel.callbacks.automatic_deregistration")
         except EventSchedule.DoesNotExist:
             # automatically deregister users we haven't seen in 3 weeks
             set_daily_event("weltel.callbacks.automatic_deregistration", \
                             hour=0, minute=15, callback_args=3)
             
         # set up bi-weekly shida report
         try:
             EventSchedule.objects.get(callback="weltel.callbacks.shida_report")
         except EventSchedule.DoesNotExist:
             schedule = EventSchedule(callback="weltel.callbacks.shida_report", \
                                      hours=set([8,15]), minutes=set([0]) )
             schedule.save()
예제 #2
0
파일: app.py 프로젝트: zimrapid/rapidsms
    def start(self):
        """Configure your app in the start phase."""
        if not self.bootstrapped:
            # initialize the forms app for registration
            self._form_app = self.router.get_app("form")
            # this tells the form app to add itself as a message handler
            # which registers the regex and function that this will dispatch to
            self._form_app.add_message_handler_to(self)

            formslogic = WeltelFormsLogic()
            formslogic.app = self
            # this tells the form app that this is also a form handler
            self._form_app.add_form_handler("weltel", formslogic)

            self.boostrapped = True

            # set up bi-daily shida report
            try:
                EventSchedule.objects.get(callback="weltel.callbacks.shida_report")
            except EventSchedule.DoesNotExist:
                schedule = EventSchedule(callback="weltel.callbacks.shida_report", hours=set([8, 14]), minutes=set([0]))
                schedule.save()

            # set up daily inactive check
            try:
                EventSchedule.objects.get(callback="weltel.callbacks.mark_inactive")
            except EventSchedule.DoesNotExist:
                set_daily_event("weltel.callbacks.mark_inactive", hour=0, minute=15, callback_args=[3])

            # set up daily 'other report'
            try:
                EventSchedule.objects.get(callback="weltel.callbacks.other_report")
            except EventSchedule.DoesNotExist:
                set_daily_event("weltel.callbacks.other_report", hour=14, minute=30, callback_args=[])
예제 #3
0
파일: app.py 프로젝트: dimagi/rapidsms-old
    def start (self):
        """Configure your app in the start phase."""
        if not self.bootstrapped:
            # initialize the forms app for registration
            self._form_app = self.router.get_app("form")
            # this tells the form app to add itself as a message handler
            # which registers the regex and function that this will dispatch to
            self._form_app.add_message_handler_to(self)
            
            formslogic = WeltelFormsLogic()
            formslogic.app = self
            # this tells the form app that this is also a form handler 
            self._form_app.add_form_handler("weltel", formslogic)
            
            self.boostrapped = True
            
            # set up bi-daily shida report
            try:
                EventSchedule.objects.get(callback="weltel.callbacks.shida_report")
            except EventSchedule.DoesNotExist:
                schedule = EventSchedule(callback="weltel.callbacks.shida_report", \
                                         hours=set([8,14]), minutes=set([0]) )
                schedule.save()

            # set up daily inactive check
            try:
                EventSchedule.objects.get(callback="weltel.callbacks.mark_inactive")
            except EventSchedule.DoesNotExist:
                set_daily_event("weltel.callbacks.mark_inactive", 
                                hour=0, minute=15, callback_args=[3])

            # set up daily 'other report'
            try:
                EventSchedule.objects.get(callback="weltel.callbacks.other_report")
            except EventSchedule.DoesNotExist:
                set_daily_event("weltel.callbacks.other_report", 
                                hour=14, minute=30, callback_args=[])