<s> from __pyjamas__ import JS <EOL> def asyncUpload ( url , file , handler ) : <EOL> xmlHttp = doCreateXmlHTTPRequest ( ) <EOL> def onload ( evnt = None ) : <EOL> global xmlHttp , handler <EOL> localHandler = handler <EOL> status = xmlHttp . status <EOL> localHandler . onload ( status ) <EOL> def onprogress ( evnt = None ) : <EOL> global xmlHttp , handler <EOL> localHandler = handler <EOL> localHandler . onprogress ( evnt . loaded , evnt . total ) <EOL> def onerror ( evnt = None ) : <EOL> global xmlHttp , handler <EOL> localHandler = handler <EOL> status = xmlHttp . status <EOL> localHandler . onerror ( status ) <EOL> xmlHttp . upload . load = onload <EOL> xmlHttp . upload . progress = onprogress <EOL> xmlHttp . upload . onload = onload <EOL> xmlHttp . upload . onprogress = onprogress <EOL> xmlHttp . upload . onerror = onerror <EOL> wubwubwub = <NUM_LIT:1> <EOL> try : <EOL> xmlHttp . open ( "<STR_LIT:POST>" , url , True ) <EOL> JS ( """<STR_LIT>""" ) <EOL> except : <EOL> JS ( "<STR_LIT>" ) <EOL> xmlHttp = None <EOL> handler = None <EOL> import sys <EOL> Window . alert ( str ( sys . exc_info ( ) [ <NUM_LIT:1> ] ) ) <EOL> return False <EOL> return True <EOL> def doCreateXmlHTTPRequest ( ) : <EOL> try : <EOL> res = JS ( """<STR_LIT>""" ) <EOL> return res <EOL> except : <EOL> pass <EOL> if JS ( """<STR_LIT>""" ) : <EOL> res = JS ( """<STR_LIT>""" ) <EOL> return res <EOL> return None <EOL> def is_old_browser ( ) : <EOL> try : <EOL> JS ( "<STR_LIT>" ) <EOL> return False <EOL> except : <EOL> return True </s>
