Gustavo Narea schrieb: > Where "overloader" is a class instance with the __getattr__ method defined, > so > we can return the class "in_group" (the class itself, not an instance). This > method will be implemented like this: > """ > def __getattr__(self, name): > original_class = self.get_predicate_checker(name) > class BooleanPredicate(original_class): > def __nonzero__(self,): > return self.is_met() > return BooleanPredicate > """
I thught the problem was that is_met() needs the environment? So I guess you wanted to say that "overloader" stores the environment in an attribute when instantiated and then calls self.is_met(self._environ). By the way, isn't this pretty much the same idea as option 4) that had been proposed already here? http://trac.turbogears.org/ticket/2205 One thing I don't like in this solution is all the overhead that makes things hard to understand and is bad for performance (your proposed get_predicate_checker even has a for loop in it). -- Christoph --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en -~----------~----~----~----~------~----~------~--~---
