<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>


<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>

<div dir="ltr">> Some of these values look wrong. Your 'path' ought to be as the<br><div>> browser sees it, and your 'domain' ditto; <br>...<br>> Otherwise, I would recommend omitting those elements and allowing the<br>> defaults through.<br><br>So I commented out those lines and now have this:<br><br>#!/usr/bin/env python<br><br>import string<br>import os<br>import datetime, Cookie, random<br>import time<br><br>ourTime = str(time.time())<br>cookie = Cookie.SimpleCookie()<br>cookie['lastvisit'] = str(time.time())<br><br>print cookie<br>print 'Content-Type: text/html\n'<br><br>print '<html><body>'<br>print '<p>Server time is', time.asctime(time.localtime()), '</p>'<br><br># The returned cookie is available in the os.environ dictionary<br>cookie_string = os.environ.get('HTTP_COOKIE')<br><br># The first time the page is run there will be no cookies<br>if not cookie_string:<br>    print '<p>First visit or cookies disabled</p>'<br>    cookie = string.replace(ourTime, '.', '')<br>    cookie = Cookie.SimpleCookie()<br>    expiration = datetime.datetime.now() + datetime.timedelta(days=30)<br>    cookie['lastvisit'] = str(time.time())<br>    cookie['lastvisit']['expires'] = 30 * 24 * 60 * 60<br>#    cookie['lastvisit']['path'] = '/var/www/html/my_site'<br>    cookie['lastvisit']['comment'] = 'holds the last user\'s visit date'<br>#    cookie['lastvisit']['domain'] = '.www.my_site.com'<br>    cookie['lastvisit']['max-age'] = 30 * 24 * 60 * 60<br>    cookie['lastvisit']['secure'] = ''<br>    cookie['lastvisit']['version'] = 1<br><br>else: # Run the page twice to retrieve the cookie<br>   print '<p>The returned cookie string was "' + cookie_string + '"</p>'<br>#   cookie = string.replace(string.split(str(cookie['lastvisit']), '=')[1], '.', '')[:-1]<br>   # load() parses the cookie string<br>   cookie.load(cookie_string)<br>   # Use the value attribute of the cookie to get it<br>   lastvisit = float(cookie['lastvisit'].value)<br>   for morsel in cookie:<br>     print '<p>', morsel, '=', cookie[morsel].value<br>     print '<div style="margin:-1em auto auto 3em;">'<br>     for key in cookie[morsel]:<br>       print key, '=', cookie[morsel][key], '<br />'<br>   print '</div></p>'<br>#   for key, morsel in cookie.iteritems():<br>#     print "key: %s\n" % key<br>#     print "morsel: %s\n\n" % morsel<br><br>print '</body></html>'<br><br><br>and it does the same thing: namely, when I clear out the cookie, it creates a cookie but apparently not with the data I'm trying to push and when I refresh it displays all the keys without any morsel values. What do?<br>TIA,<br>Jack<br></div></div>
                                          </div></body>
</html>