view roundup/cgi/ComputedAttribute.py @ 1028:16498e77e3ff

allow overiding of the index args roundup/cgi/templating.py
author Richard Jones <richard@users.sourceforge.net>
date Tue, 03 Sep 2002 07:33:01 +0000
parents 55ab0c5b49f9
children
line wrap: on
line source

class ComputedAttribute:
    def __init__(self, callable, level):
        self.callable = callable
        self.level = level
    def __of__(self, *args):
        if self.level > 0:
            return self.callable
        if isinstance(self.callable, type('')):
            return getattr(args[0], self.callable)
        return self.callable(*args)


Roundup Issue Tracker: http://roundup-tracker.org/