Gustavo said:
> """
> def __getattr__(self, name):
> original_class = self.get_predicate_checker(name)
> class BooleanPredicate(original_class):
> def __nonzero__(self,):
> return self.is_met()
> return BooleanPredicate
> """
Sorry, forgot to explain how get_predicate_checker() would look like:
"""
def get_predicate_checker(self, name):
for mod in self.predicate_modules:
if hasattr(mod, name):
return getattr(mod, name)
raise NameError(...)
"""
As a consequence:
1.- User-defined predicate checkers could be used in the same namespace.
2.- This could also be used in the controllers, not only in the templates.
Cheers!
--
Gustavo Narea <xri://=Gustavo>.
| Tech blog: =Gustavo/(+blog)/tech ~ About me: =Gustavo/about |
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---