Thanks for your reply and the information on mod_python. I
will try if
i can get it working with sessions.
On May 25, 6:55 pm, Tim Roberts <t... probo.com> wrote:
> mdehollan... gmail.com wrote:
> > I am working on a cherrypy application with a
simple form. The form is
> > submitted to a method submit_job together with all
form parameteres. I
> > don't want to send all parameters in the form
request, so i thought i
> > could save them as class attributes like this:
> > class Page( object) :
> > def __init__ (self):
> > self.var1 = random.randint()
> > def index(self):
> > self.var2 = "test"
> > def submit_job(self, var1):
> > print var1
> > print self.var1
> > print self.var2
>
> Those aren't class attributes. They are instance
attributes. However,
> that's irrelevant here.
Yes, you're right. Shame on me.
>
> A mod_python-based server runs in multiple threads, and
there's no
> guarantee that the same object -- or even the same
instance of the
> interpreter -- will handle the request every time. You
can't rely on
> instance attributes persisting from one request to
another.
Ah, that explains a lot.
>
> > What is the best way to use class attributes
within the submit_job
> > method without passing them into the form? Should
i use sessions? Or
> > are there any other solutions within cherrypy? Or
could it be a Apache
> > thing?
>
> You either need to pass everything in the form or use a
session.
Ok, i will try the sessions first.
>
> --
> Tim Roberts, t... probo.com
> Providenza & Boekelheide, Inc.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users googlegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribe googlegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|