[Fwd: Re: [mod_python] [Fwd: Defining classes using mod_python]]

Luis Sousa llsousa at ualg.pt
Fri Mar 8 16:22:54 EST 2002


I tried the sugestion that you gave me but it still working without 
giving me an error !!!
I tried putting the PythonHandler in apache directly to file and it gave 
me the error that I was expecting.

Probably it's some problem in my configuration, or something else !!!
What could it be ?

Luis Sousa

Gregory (Grisha) Trubetskoy wrote:

>This is probably because you're chaning pessoalWEB but the Python
>interpreter ignores those changes because the pessoalWEB module is already
>imported. You need to reload pessoalWEB or restart apache. There is a note
>about that in the FAQ:
>
>http://www.modpython.org/FAQ/faqw.py?req=all#3.1
>
>P.S. There is nothing wrong with the publisher handler, it should work for
>you just fine.
>
>Grisha
>
>
>On Fri, 8 Mar 2002, Luis Sousa wrote:
>
>>>I have two files, one that I used to define a class and other one that
>>>calls the class:
>>>   - file that defines the class: pessoalWEB.py
>>>
>>>               class MyClass:
>>>                   def __init__ (self):
>>>                       self.x = ''
>>>                       self.y = ''
>>>
>>>   - file that uses the class: callClassWEB.py
>>>                import pessoalWEB
>>>
>>>               def testFunc():
>>>                   MyClass = pessoalWEB.MyClass()
>>>                   saida = MyClass.x
>>>                   saida = MyClass.y
>>>                   if saida=='':
>>>                       saida="NULL"
>>>                     return saida
>>>
>>>I call this file using
>>>http://machinename/~llsousa/gpessoal/callClassWEB.py/testFunc in my
>>>browser.
>>>
>>I already saw what was the problem. The object. was not well
>>initialized. It was MyClass = pessoal.MyClass() instead of MyClass =
>>pessoalWEB.MyClass()
>>
>>But now I notice something strange. When I define saida = MyClass.k it
>>gave no error.
>>Souldn't it gave an error like this: AttributeError: MyClass instance
>>has no attribute 'k' ???
>>
>>Why it doesn't do that ?
>>
>>Thanks, Luis Sousa
>>
>>_______________________________________________
>>Mod_python mailing list
>>Mod_python at modpython.org
>>http://www.modpython.org/mailman/listinfo/mod_python
>>
>
>
>






More information about the Mod_python mailing list