Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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()
Exemplo n.º 3
0
 def set_cookie(self):
     Cookies.setCookie(self.unique_id,"freshly baked",10000000)
Exemplo n.º 4
0
 def is_cookie_set(self):
     if (Cookies.getCookie(self.unique_id)):
         return True
     else:
         return False
Exemplo n.º 5
0
def _deleteCookie():
    # Set the cookie back in time a few years.
    Cookies.setCookie(defaults.OAUTH_COOKIE, '', -100000000)