On Mon, 2002-08-12 at 07:59, Chuck Esterbrook wrote:
> I see that PSP has a way to define methods for the page. But what if I
> want the equivalent of:
> class SomePage(SuperPage):
> shouldFooBar = 1
> e.g., I want to set "shouldFooBar" at the class level. (The reason is
> that SuperPage examines "self.shouldFooBar" in _respond() for special
> So PSP has this:
> <psp:method name="MyClassMethod" params="var1, var2">
> I'd like to propose:
> <psp:set name="shouldFooBar" value="1">
Seems OK to me, but see bleow for other ideas...
> The value is just pure Python source (between quotation marks).
I take it you don't want the overhead of calling a method, otherwise you
would have just defined a method that returned a bool.
One possibility without changing the PSP syntax is to write 2 base
classes in a Python module, whose sole purpose is to provide a setting
for shouldFooBar. Then multiply inherit from the appropriate base
shouldFooBar = 1
shouldFooBar = 0
# In a PSP
<%@ page imports="ShouldFooBar:ShouldNotFooBar"
<%@ page extends="SuperPage,ShouldNotFooBar"%>