def apply(self, identity, core_allocation):
     """
     Create an allocation.models.allocationstrategy
     """
     now = timezone.now()
     counting_behavior = self._parse_counting_behavior(identity, now)
     refresh_behaviors = self._parse_refresh_behaviors(identity, now)
     rules_behaviors = self._parse_rules_behaviors()
     new_strategy = PythonAllocationStrategy(
         counting_behavior, refresh_behaviors, rules_behaviors)
     return new_strategy.apply(identity, core_allocation)
Esempio n. 2
0
 def apply(self, identity, core_allocation, limit_instances=[], limit_history=[], start_date=None, end_date=None):
     """
     Create an allocation.models.allocationstrategy
     """
     now = timezone.now()
     counting_behavior = self._parse_counting_behavior(identity, now, start_date, end_date)
     refresh_behaviors = self._parse_refresh_behaviors(identity, now, start_date)
     rules_behaviors = self._parse_rules_behaviors()
     new_strategy = PythonAllocationStrategy(
         counting_behavior, refresh_behaviors, rules_behaviors)
     return new_strategy.apply(
         identity, core_allocation,
         limit_instances=limit_instances, limit_history=limit_history)
Esempio n. 3
0
 def apply(self,
           identity,
           core_allocation,
           limit_instances=[],
           limit_history=[],
           start_date=None,
           end_date=None):
     """
     Create an allocation.models.allocationstrategy
     """
     now = timezone.now()
     counting_behavior = self._parse_counting_behavior(
         identity, now, start_date, end_date)
     refresh_behaviors = self._parse_refresh_behaviors(
         identity, now, start_date)
     rules_behaviors = self._parse_rules_behaviors()
     new_strategy = PythonAllocationStrategy(counting_behavior,
                                             refresh_behaviors,
                                             rules_behaviors)
     return new_strategy.apply(identity,
                               core_allocation,
                               limit_instances=limit_instances,
                               limit_history=limit_history)