Exemplo n.º 1
0
 def get_all_published_event(self):
     
     event_list = Event.query().filter(Event.published == True,Event.deleted==False,
                                       Event.type == 'free', Event.date_event > (datetime.datetime.now())-REVIEW_TIME)
     if not event_list.get():
         return None, None
     else:
         event_list = event_list.order(Event.date_event)
         #on supposera qu'il n'y aura pas plus de 2000 events en l'espace d'un mois
         event_list = event_list.fetch(2000)
         last_edited = sorted(event_list, key=attrgetter('date_modified'),reverse=True)[0].date_modified
         
         return last_edited, event_list
Exemplo n.º 2
0
 def get_updated_event_list(self, edited_after):
     """
     This is a function to get the list of available events
     """
     
     
     event_list = Event.query().filter(Event.published == True,
                                       Event.type == 'free', Event.date_modified > edited_after)
     
     if not event_list.get():
         return None, None
     
     event_list = event_list.order(-Event.date_modified)
     last_update_time = event_list.get().date_modified
     
     event_list = event_list.fetch(2000)
     
     event_list = filter(lambda event: event.date_event > (datetime.datetime.now()-REVIEW_TIME), event_list)
     
     if len(event_list) == 0:
             return None, None
         
     return last_update_time, event_list