I'm having some issues retrieving cookies sent by the client on the server using the python module cherrypy.
In the web browser I can see the cookies in Chrome's Web Console by going to Resources -> Cookies -> localhost. And then I have 3 cookies with the following values.
And on the server side I have the following information from the Eclipse debugger:
My question is why don't foo and release_id show up in the keys? Is there something I'm doing wrong?
NOTE:
cookies = cherrypy.request.cookie
Javascript code for setting the cookies:
$(function() {
// Functions from W3C Schools: http://www.w3schools.com/js/js_cookies.asp
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+d.toUTCString() + ";";
var path = "path=/;" // Accessible to all.
document.cookie = cname + "=" + cvalue + "; " + expires + path;
}
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1);
if (c.indexOf(name) != -1) return c.substring(name.length, c.length);
}
return "";
}
setCookie("foo", "bar", 1 );
setCookie("release_id", "2", 1 );
});