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 
> purposes.)
> 
> 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).
> 
> Reactions?
> 

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
class:

# ShouldFooBar.py
class ShouldFooBar:
        shouldFooBar = 1
class ShouldNotFooBar:
        shouldFooBar = 0

# In a PSP
<%@ page imports="ShouldFooBar:ShouldNotFooBar"
<%@ page extends="SuperPage,ShouldNotFooBar"%>


- Geoff




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to