Ejemplo n.º 1
0
    def action(self, option):
        if option == "b":
            return ListView(Storage.all())
        if option == "e":
            return EditView(self._model)
        if option == "d":
            self._deleting = True

        if self._deleting and option == "y":
            Storage.delete(self._model.id)
            return ListView(Storage.all())
        if self._deleting and option == "n":
            self._deleting = False
        
        return None
Ejemplo n.º 2
0
    def action(self, option):
        if option == "q":
            return BaseView()

        if option == "1":
            return ListView(Storage.all())

        return None
Ejemplo n.º 3
0
    def action(self, option):  
        if option == "y":
            Storage.add(self._tempWorker)
       
        if option == "y" or option == "n":
            self._tempWorker = None
            return ListView(Storage.all())

        return None
Ejemplo n.º 4
0
 def execute(task, campaign):
   storage_query = Storage.all().filter('campaign =', campaign)
   if (storage_query.count(limit = 1)):
     for datum in storage_query.fetch(100):
       logging.info('checking for stats: %s' % datum.stats.key())
       if (Histogram.has(datum.stats) and not TaskModel.has(datum.stats)): #perhaps use a pickled dictionary instead of count queries
         if (not TaskModel(object = datum.stats, task = 'delete histogram').put()):
           logging.critical('Could not create delete histogram task for %s' % datum.stats)
       else:
         datum.stat.delete()
       datum.delete()
   else:
     task.delete()
     logging.info('Nothing left in storage to clean up for campaign %s' % campaign)
     return True
Ejemplo n.º 5
0
 def get_values(cls, campaign, ns, path = '', keys_only = False):
   query = Storage.all(keys_only = keys_only).filter('campaign = ', campaign).filter('namespace = ', ns).order('-created_on')
   return [datum for datum in query] # todo, paginator/generator