Στις 6/10/2013 2:36 πμ, ο/η Denis McMahon έγραψε:
On Sat, 05 Oct 2013 16:38:14 +0300, Νίκος Αλεξόπουλος wrote:

[my cookie code is fucked]

Hi Nick

I had never used python for www before yesterday. I had never used python
before about 6 months ago.

In the last 24 hours I have installed mod-wsgi on my apache web server,
and written test code that enables me to see the result of all
environment data, parse the get string, parse post data, set and parse
cookies, and save session data to a file specific to the cookie data.

There may be better ways to do some of it, but it works.

Here is a link to the text of my python file:

http://www.sined.co.uk/tmp/index.py.txt

Once you have read through it (there are comments) and understood how it
handles cookies and session data, you will realise that you can add and
modify any session data just by adding relevant items to and reading them
from the session data dictionary. The session data stays on the server,
the cookie simply identifies the session (and the session data file), and
hopefully is unique to the user.

Don't ask me any questions about why I did something the way I did it. I
did it that way because it works. If anyone knows a different way that
also works and maybe works better, feel free to discuss it. But Nick,
don't you dare suggest any change that doesn't work because you think it
looks better.

If you don't understand a module function that I've used, read the python
documentation for it.

If you think you have a question that is  not covered by the above
statements, feel free to ask me, here, why I wrote a given line number or
group of line numbers the way I did. However, see the notes above - the
answer will probably be "because it works that way".

If you quote the whole file or even large chunks of it here, I am
finished with trying to help you, ever!

Thank you Denis, i didn't knew about sessions up until i saw you post.
Your code is very advanced for me to read but i will try to "decode it"
I though that if we want to read something from our visitor, something we want, we have to save it to his browser a cookie, that we later retrieve within our python script's code.

What "sessions" do more compared to just using cookies?

i use 'cgi', but i noticed you used 'mod-wsgi'.
I want to ask you why you chose the latter? Is the latter better than the former?

Is it faster? Does it bahave the same way?
I my code works works with cgi, which it does, will the same code works with mod-wcgi?


--
What is now proved was at first only imagined! & WebHost
<http://superhost.gr>
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to