def asyncPostImpl(self, user, pwd, url, postData, handler): xmlHttp = self.doCreateXmlHTTPRequest() print "xmlHttp", user, pwd, url, postData, handler, dir(xmlHttp) #try : xmlHttp.open("POST", url, True, '', '') xmlHttp.set_request_header("Content-Type", "text/plain charset=utf-8") for c in Cookies.get_crumbs(): xmlHttp.set_request_header("Set-Cookie", c) print "setting cookie", c xmlHttp.connect("browser-event", self.onReadyStateChange) xmlHttp.add_event_listener("onreadystatechange") xmlHttp.handler = handler # hmm... #post_doc = get_main_frame().create_text_gdom_document() #body = post_doc.create_element("body") #tn = post_doc.create_text_node(postData) #post_doc.append_child(tn) #post_doc.props.body = body #print post_doc, dir(post_doc), list(post_doc.props) #print "inner html", post_doc.props.body.props.inner_html #sys.exit(0) #xmlHttp.send(post_doc) xmlHttp.send(postData) return True #except: #del xmlHttp.onreadystatechange handler = None xmlHttp = None localHandler.onError(str(e)) return False
def __init__(self): Grid.__init__(self, 1, 2, StyleName='login-panel') self.setCellPadding(0) self.setCellSpacing(0) formatter = self.getCellFormatter() # formatter.setWidth(0, 0, '100%') formatter.setHorizontalAlignment(0, 0, 'right') formatter.setHorizontalAlignment(0, 1, 'right') self.loggedIn = False self.screenname = None self.friendsIds = None self.userListPanels = [] self.oauthCookie = Cookies.getCookie(defaults.OAUTH_COOKIE) if self.oauthCookie: remote = server.TickeryService() id = remote.screenameFromCookie(self.oauthCookie, DisplayLoggedIn(self)) if id < 0: self.setWidget(0, 1, Label('oops: getScreenameFromCookie')) else: self.notLoggedIn()
def set_cookie(self): Cookies.setCookie(self.unique_id,"freshly baked",10000000)
def is_cookie_set(self): if (Cookies.getCookie(self.unique_id)): return True else: return False
def _deleteCookie(): # Set the cookie back in time a few years. Cookies.setCookie(defaults.OAUTH_COOKIE, '', -100000000)