[mod_python] Questions on _call_ with mp servlets and python

Vinj Vinj vinjvinj at yahoo.com
Thu Sep 2 14:19:16 EDT 2004


I figured out a way to do this, but I'm not sure it is
too elegant:

Have your output go to a string in your _call_
do_some_function()

so replace self.write with self.result.append

and in your write_content function have the following:

self.writeln("".join(self.result))

Also does anyone know how to redirect the current
request to another servlet so that the current req
object is kept intact. The problem in some more
details is as follows. I have an application which
checks to see if a user is logged in through the
session. However, if the user is not logged in I want
to redirect to the login servlet with the error
message sent as part of the req object. 

I can do that by /Login?err_msg="You have to be logged
in" however then anyone can send messages to my login
screen which get displayed on the return. I'd rather
have someway (secure) of passing the err_msg
internally. 


--- Vinj Vinj <vinjvinj at yahoo.com> wrote:

> First of all thank you for providing mpservlet. I
> ,like many people, have used zope, quxiote, and
> webware and have finally found mpservlet which is
> exactly what I need. I'm trying to use _call_ but
> have
> some questions suggestions. My site has a yahoo like
> interface which has a lot of links which perform
> actions. These actions(links) go thorugh http get. 
> 
> I changed the repsond so that the servlet looks for
> the _call_ form variable function gets called even
> if
> it comes from a get request. 
> 
> The second thing I would like to have is _call_
> function just be called for generating the content.
> So
> in effect if I subclass HTMLPage and use the _call_
> functionality my header and nav and footer functions
> don't get called. This seems strange to since almost
> every action would have to generate some content.
> 
> 
> Thanks!
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
>
http://mailman.modpython.org/mailman/listinfo/mod_python
> 



More information about the Mod_python mailing list