joerussbowman / gaeutilities

gaeutilities - A collection of utilities to help with application development on Google Appengine
http://gaeutilities.appspot.com
BSD 3-Clause "New" or "Revised" License
78 stars 4 forks source link

Cookie problems with Safari #26

Open herrbuerger opened 13 years ago

herrbuerger commented 13 years ago

Hey,

I'm not sure if you still actively develop gaeutilities, but I thought I give it a try since I'm banging my head against the wall with this one.

This small example works without problems in every brower:

class Flash(webapp.RequestHandler):
  def get(self):
    self.flash = flash.Flash()
    if self.request.get('setflash') == "true":
        self.flash.msg = ({'type':'success','msg':'You set a flash message! <a href="/flash">Refresh this page</a> and this message is gone!'})
        self.redirect('/flash')
    else:
        self.response.out.write(self.flash.msg)

While this one works in all browser except Safari (Windows or Mac):

class SetCookie(webapp.RequestHandler):
  def get(self):
    self.flash = flash.Flash()
    self.flash.msg = ({'type':'success','msg':'You set a flash message! <a href="/flash">Refresh this page</a> and this message is gone!'})
    self.redirect('/showcookie')

class ShowCookie(webapp.RequestHandler):
  def get(self):
    self.flash = flash.Flash()
    self.response.out.write(self.flash.msg)

As you can see I'm trying to set the cookie on one page and then show it on another. As stated, this works in all browsers except Safari. Do you have any idea, what can be done to fix this problem? Or is my implementation simply wrong? The self.flash = flash.Flash() in the ShowCookie handler basically creates a new cookie, which is not exactly what I want but I don't know how to access the stored value otherwise.

Thanks in advance, Chris

joerussbowman commented 13 years ago

Can you see if the cookie is being set? Sorry, I am responding to requests for support even though not active on the project. However, for the next couple weeks I am totally consumed by my job as we're pushing a major initiative live and I'm not sure when I can look at this.

I do have a Mac now at least, so I'll see if I can troubleshoot this when I have time.

Offhand I don't see why one would work and the other wouldn't.

The only other thing I can think of is the intention of flash was for flash.msg to be a string, not an object. You may want to try just setting it to a string and see if that works cross all browsers.