Пример #1
0
    def do_book(self, data):
        '''
        Execute the multiple booking
        '''
        booker = IBooker(self.context.aq_inner)
        slots = self.get_slots(data)
        start_date = DateTime(data['start_date'].strftime('%Y/%m/%d'))
        for slot in slots:
            booking_date = start_date + (float(slot.lower_value) / 86400)
            slot.__class__ = BaseSlot
            duration = float(len(slot)) / 86400
            # duration = float(len(slot)) / 60
            slot_data = {'fullname': data['title'],
                         'subject': u'',
                         'agency': u'',
                         'booking_date': booking_date,
                         'telefono': u'',
                         'mobile': u'',
                         'email': u'',
                         'tipologia_prenotazione': u'',
                         }
            booker.create(slot_data,
                          duration=duration,
                          force_gate=data.get('gate'))

        msg = _('booking_created')
        IStatusMessage(self.request).add(msg, 'info')
 def do_book(self, data):
     '''
     Create a Booking!
     '''
     booker = IBooker(self.context.aq_inner)
     return booker.create(data)
 def booker(self):
     """
     Return the conflict manager for this context
     """
     return IBooker(self.context.aq_inner)