view roundup/cgi/ComputedAttribute.py @ 999:8d54c0f3198e

Fixed history and its nihilism. Added convenience method for submit buttons
author Richard Jones <richard@users.sourceforge.net>
date Sat, 31 Aug 2002 12:07:48 +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/