> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Michel Thadeu
> Sent: Saturday, 1 May 2004 1:21 AM
> To: [EMAIL PROTECTED]
> Subject: [Webware-discuss] How can I always reload modules?
> 
> Hi guys!
> 
> See my trouble:
> 
> I created a class and used the action funcionality, i.e:
> 
> class SomeClass(Page):
>   def writeContent(self):
>     self.writeln('some initial content')
> 
>   def action(self):
>     return Page.actions() + ['test1', 'test2']
> 
>   def test1(self):
>     self.writeContent=lambda s=self: s.writeln('function test1 not
> implemented')
>     self.writeHTML()
> 
>   def test2(self):
>     self.writeContent=lambda s=self: s.writeln('function test2 not
> implemented')
>     self.writeHTML()
> 
> The problem is when I access the action test1 (with a submit 
> button), the page will show me always "function test1 not 
> implemented"...

This is what the code shows that it should be doing i.e

in def test1, you assign writeContent to your lambda function, which writes
"function test1 not implemented".

What output were you expecting ?

> How can I avoid this problem? The same occours for list 
> objects inside the class. I have the self._error list, I 
> store in this list some error messages (form not completed, 
> you have to fill your name, etc). If the self._error is false 
> (not self._error) i do nothing, but if there is an error, I 
> execute the writeContent of the Form class (I have 2 classes, 
> a Form class and a Process class, the Process class 
> inhiterits the Form class.
> 
> One time I had an error, this error will be always shown, how 
> can I avoid this?

Where did you define your _error list ? If you it's in __init__, then you
must remember to clear it after every request, or you can clear it out in
def awake() before each requests starts. This is because each servlet is
__init__ only once.

Are your error messages session specific ? Do they need to persist across
requests ? If yes, you may need a different approach altogether

Huy



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE. 
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to