diff roundup/cgi/ComputedAttribute.py @ 985:55ab0c5b49f9

New CGI interface support
author Richard Jones <richard@users.sourceforge.net>
date Fri, 30 Aug 2002 08:28:44 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/roundup/cgi/ComputedAttribute.py	Fri Aug 30 08:28:44 2002 +0000
@@ -0,0 +1,11 @@
+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/