The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Python Programming
|
retrieving cookies
Discuss retrieving cookies in the Python Programming forum on Dev Shed. retrieving cookies Python Programming forum discussing coding techniques, tips and tricks, and Zope related information. Python was designed from the ground up to be a completely object-oriented programming language.
|
|
 |
|
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

October 14th, 2003, 06:29 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 36
Time spent in forums: < 1 sec
Reputation Power: 10
|
|
|
retrieving cookies
how do you check if theres a cookie and if there is retrieve it???
|

October 14th, 2003, 06:42 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 36
Time spent in forums: < 1 sec
Reputation Power: 10
|
|
|
Also i'm creating a message board like this one witth MySQL as my database?? How do you recommend i set up the databases and tables.
so far i have:
users>users>(all the users)
General>threads>posts
with general being a database containg the threads and posts of the message board section general. Then I would have another database for each section of the message board. Like Spam, and Linux
|

October 14th, 2003, 06:59 PM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
See the documentation of the load method of the Cookie object here.
http://web.pydoc.org/2.2/Cookie.html
As to your second question, is there any reason you should have separate databases. I mean, can you just store all the information in different tables of the same database?
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
|

October 14th, 2003, 07:23 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 36
Time spent in forums: < 1 sec
Reputation Power: 10
|
|
|
i dont know can I?? how would i do it, how would i label wich thread belongs to which section of the message board i.e. general or spam. Another problem i have run into is if a have a list of names which link to the different parts of the sections All on one page, how do i know one the user chose?? There doesnt seem to be a value key in a hyperlink. Would i have to create a different script for each section of the message board(basically changing the values of which section to show) or is there an easier way.
|

October 14th, 2003, 07:26 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 36
Time spent in forums: < 1 sec
Reputation Power: 10
|
|
|
ahh can you give me a specific example of how to load a simple cookie because i cant find any examples on the page you diricted me too.
|

October 14th, 2003, 07:33 PM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
Something like this:
Code:
import os
import Cookie
cookies = Cookie.Cookie()
cookies.load(os.environ["HTTP_COOKIE"])
print cookies
print cookies["cookie_name"].value
|

October 15th, 2003, 02:32 AM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
Quote: Originally posted by Arkamir
Another problem i have run into is if a have a list of names which link to the different parts of the sections All on one page, how do i know one the user chose?? There doesnt seem to be a value key in a hyperlink. |
You migt find this thread interesting http://forums.devshed.com/t81768/s.html
Edit: On the subject of database setup i'd go with scorpi and only use one database which holds multiple tables, one for 'users' which containts profile info (nick, email etc) and then seperate tables for each section you want to add.. as for naming thats just something your gonna have to play around with
Mark.
__________________
programming language development: www.netytan.com – Hula
Last edited by netytan : October 15th, 2003 at 02:44 AM.
|

October 15th, 2003, 02:25 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 36
Time spent in forums: < 1 sec
Reputation Power: 10
|
|
|
<a href="mycgi.py?show=1">page 1</a>
how would i retrieve show=1
|

October 15th, 2003, 02:32 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 36
Time spent in forums: < 1 sec
Reputation Power: 10
|
|
|
Also do you recommend having 1 database with a table for users, and then
a table for each section? and then when a user posts the usrname, post, and thread go in the table. Then when someone request a specific thread i search through the table and take evrything where thread = thatthread??
thanks a lot
|

October 15th, 2003, 02:53 PM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
|

October 15th, 2003, 06:45 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 36
Time spent in forums: < 1 sec
Reputation Power: 10
|
|
can you give me an example of how to parse the header i'm still very much a newb. Oh and i do know that is a header 
|

October 15th, 2003, 10:24 PM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
|

October 16th, 2003, 07:04 AM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
Quote: | Also do you recommend having 1 database with a table for users, and then a table for each section? |
I personally would go for 1 user table, and a new table for each forum you want to create. so if you this forum would be in a table called 'Python' and the perl forum would be in a table named 'Perl'.. somewhere in each forum table (possibly the id) should point at the main thread (just to make it easier to pull results), it's been a while since i messed around with message boards.. but i'm sure you'll get it
Half the trick here is to use the data you get from the query string (as demistrated by scorpi) to determin what data you pull from the database. And when you have the shell you can build boundless features into it pretty easily!
I for one would be very interested in your final piece  , so make sure you post your code and give a lil speach when you done  (that is if you don't mind)
Mark.
Last edited by netytan : October 16th, 2003 at 07:09 AM.
|

October 16th, 2003, 06:46 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 36
Time spent in forums: < 1 sec
Reputation Power: 10
|
|
|
I plan to release it under the gpl, cuz i got so much help from everyone.
I'll probaly create a 'company' called Radiol Technologies and a website to go with it
|

November 2nd, 2003, 02:46 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 36
Time spent in forums: < 1 sec
Reputation Power: 10
|
|
|
would Http_Cookie eqaul the cookie i want to load??
import os
import Cookie
cookies = Cookie.Cookie()
cookies.load(os.environ["HTTP_COOKIE"])
print cookies
print cookies["cookie_name"].value
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|