Why does Cookie method fail???
David Lees
debl.nononospam.none at world.std.com
Thu Nov 16 00:13:49 EST 2000
I am confused even more. I thought the domain was an essential part of
the cookie, but I don't see it in the examples in the reference.
Also, how do I send do the header?
Here is the cgi-bin code I am playing with.
david lees
----------------
#!/usr/local/bin/python
import cgi, os, sys, Cookie
def memberform():
list={}
print "Content-type: text/html"
print
form1 = cgi.FieldStorage()
first=form1["first"].value
last=form1["last"].value
email=form1["email"].value
fan=form1["fan"].value
list["first"]=first
list["last"]=last
list["email"]=email
list["fan"]=fan
print "<H1> Cookie Testing!</H1>"
#c = Cookie.Cookie()
#c.load(os.environ["HTTP_COOKIE"])
print '<P>The name is '+first+'</P>'
print '<P>Python Version = '+sys.version+'</P>'
if __name__ == "__main__":
memberform()
Albert Hopkins wrote:
>
> Sounce weird, but maybe you have a Cookie.py (cookie.py?) in your sys.path
> that imports Cookie and so Cookie.Cookie is instead a module.
>
> Try this:
>
> go to the directory that your cgi is in
>
> # /usr/local/bin/python
> ...
> >>> import cgi, os, sys, Cookie
> >>> Cookie.Cookie
> <class Cookie.SmartCookie at 817df58>
>
> If your interpreter doesn't say "class..." but instead says
> <module 'Cookie' from '/usr/lib/python1.5/site-packages/Cookie.py'>
> or similiar then then this might be the problem.
>
> --albert
>
> On Wed, 15 Nov 2000 19:09:07 -0500, David Lees <DavidL.nono.spam.nono at raqia.com> wrote:
> >I have the code below in a cgi-bin file (junk.py) and an error occurs
> >when I uncomment the statement: c = Cookie.Cookie()
> >I get the error:
> >
> >TypeError: Call of non-function (type module), in the Apache error_log
> >
> >This seems wierd, because the form fields are correctly passed and I am
> >able to send them back to the form. It also does not make any
> >difference whether I use Python 1.5.2 or Python 2.0. Note the HTML form
> >receives the Python version number and this works.
> >
> >Puzzled.
> >
> >David Lees
> >
> >
> >
> >#!/usr/local/bin/python
> >import cgi, os, sys, Cookie
> >
> >def memberform():
> >
> > list={}
> >
> > print "Content-type: text/html"
> > print
> >
> > form1 = cgi.FieldStorage()
> >
> > first=form1["first"].value
> > last=form1["last"].value
> > email=form1["email"].value
> > fan=form1["fan"].value
> >
> > list["first"]=first
> > list["last"]=last
> > list["email"]=email
> > list["fan"]=fan
> >
> > print "<H1> Cookie Testing!</H1>"
> > #c = Cookie.Cookie()
> > #c.load(os.environ["HTTP_COOKIE"])
> >
> > print '<P>The name is '+first+'</P>'
> >
> > print '<P>Python Version = '+sys.version+'</P>'
> >
> >
> >if __name__ == "__main__":
> > memberform()
> >
> >
>
> --
> Albert Hopkins
> Sr. Systems Specialist
> Dynacare Laboratories
> ahopkins at dynacare.com
>
> Civilization is unbearable, but it is less unbearable at the top.
> -Timothy Leary
>
> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> -----== Over 80,000 Newsgroups - 16 Different Servers! =-----
More information about the Python-list
mailing list