Beispiel #1
0
    def handle(self, *args, **options):

        for condition_class in get_all_conditions():

            for instance in condition_class.objects.all():

                if instance.has_timeout:

                    if timezone.now() > instance.get_timeout():

                        retry_action_signal.send(sender=condition_class,
                                                 instance=instance,
                                                 created=False)
Beispiel #2
0
 def get_condition_class(self, *, condition_type):
     """Get condition class object given condition type."""
     for condition in get_all_conditions():
         if condition.__name__.lower() == condition_type.lower(): return condition
Beispiel #3
0
 def is_valid_condition_type(self, condition_type, lower=True):
     condition_models = get_all_conditions()
     for model_type in condition_models:
         if lower and model_type.__name__.lower() == condition_type.lower(): return True
         if model_type.__name__ == condition_type: return True
     return False
Beispiel #4
0
 def get_possible_conditions(self):
     """Get all possible conditions."""
     return get_all_conditions()
Beispiel #5
0
def get_condition_model(condition_type):
    for condition_model in get_all_conditions():
        if condition_model.__name__.lower() == condition_type.lower():
            return condition_model