Exemple #1
0
 def refresh(self):
         
     with Session() as session:
         # Look for those effects which have expired and send out remove signals.
         punitive_effect_query = session.query(PunitiveEffect)
         punitive_effect_query = PunitiveEffect.query_expired(punitive_effect_query)
         expired_punitive_effects = punitive_effect_query.all()
         
         for punitive_effect in expired_punitive_effects:
             punitive_effect.expired = True
             self.remove.emit(punitive_effect.id)
             self.effect_list_dirty = True
             
         # Look for those effects which have been updated and send out update signals
         updated_punitive_effects = session.query(PunitiveEffect).filter(PunitiveEffect.updated==True).all()
         
         for punitive_effect in updated_punitive_effects:
             punitive_effect.updated = False
             self.effect_list_dirty = True
             if punitive_effect.expired:
                 self.remove.emit(punitive_effect.id)
             else:
                 self.update.emit(punitive_effect.id, punitive_effect.effect_type, punitive_effect.target_ip, punitive_effect.target_mask, punitive_effect.reason)
             
         session.commit()
 def refresh(self):
     "Look for those effects which have expired and send out remove signals."
     with Session() as session:
         punitive_effect_query = session.query(PunitiveEffect)
         punitive_effect_query = PunitiveEffect.expired(punitive_effect_query)
         
         expired_punitive_effects = punitive_effect_query.all()
         
         for punitive_effect in expired_punitive_effects:
             punitive_effect.expired = True
             self.remove.emit(punitive_effect.id)
             
         session.commit()
 def remove_effect(self, effect_id):
     if PunitiveEffect.expire(effect_id):
         self.effect_list_dirty = True
         self.remove.emit(effect_id)