On Thu, Jun 10, 2010 at 2:07 PM, Stephen Hansen <me+list/pyt...@ixokai.io>wrote:
> On 6/10/10 10:48 AM, Victor Subervi wrote: > > Now, create_edit_passengers3() is called by the form/submit button in > (you > > guessed it) create_edit_passengers2.py, the latter containing a var in it > > which *should* be accessible to create_edit_passengers3.py, one would > think. > > Wait, wait, wait. > > If a user is browsing to, say, > http://example.com/create_edit_passengers2.py; that script will be run, > and once -done-, print out a form which the user sees. > > At that point, create_edit_passengers2.py is dead. Gone. Over. > > Once a person then clicks Submit, and the form is sent to > http://example.com/create_edit_passengers3.py; its a whole new > environment (assuming you're using CGI, which it appears you are). > > The *only* way for state or data to get from one script to another is > not importing, or shared variables, or anything like that: you *have* to > pass it into that form, and extract it from the resulting form. You can > pass the actual variables as a <input type="hidden">, and then extract > it like any of the user-fields. Or, you can write out your state to a > local file with some unique ID, and just write out into the form that > unique ID. Or use a cookie session. Etc. > > You *can't* pass variables around script-to-script among separate CGI > sessions. It just totally doesn't work like that. Any success you think > you have had is false; it works by mere accident or illusion. Each CGI > script stands alone. It starts, runs, executes, then closes. No state is > preserved unless you *explicitly* preserve it. > You know, if this were the first time I'd worked with "passing variables around" through cgi, I'd think you may be right. But answer me this: if what you assume is correct, how in the heck is this variable being generated (and it is) in create_edit_passengers2.py<http://example.com/create_edit_passengers2.py>(as an <input type="text"...>) and then being reinstantiated in another script? That is, if what you say is true, I should not be able to access it through ANY script whatsoever after create_edit_passengers2.py<http://example.com/create_edit_passengers2.py>is "dead", right??? Look closely: 1) variable value generated is create_edit_passengers2.py<http://example.com/create_edit_passengers2.py> 2) create_edit_passengers2.py<http://example.com/create_edit_passengers2.py>calls create_edit_passengers3.py <http://example.com/create_edit_passengers2.py>via a <form...> and passes the value of the var thereunto. 3) theoretically! Yet for some reason I can't call it in create_edit_passengers3.py <http://example.com/create_edit_passengers2.py>but *can* call it in a script that is imported by create_edit_passengers3.py <http://example.com/create_edit_passengers2.py> Now you guys can make fun of me all you want, but until you actually READ and UNDERSTAND what I'm writing, I'm afraid I think your criticisms are ridiculous and make you look like fools. For those who don't criticize me and are trying to help but misunderstand, hey, what can I say, who misunderstand so much myself lol. TIA, beno
-- http://mail.python.org/mailman/listinfo/python-list