ajax - IE7 vs. A Python Pickle Object -
i have issue ie7 not wanting pass pickled object through ajax call using htmltmpl. works in ie8 (and in compatibility mode) in firefox.
i have pickled object using command:
newhash['pickled'] = pickle.dumps(hash)
because js didn't newlines, regex them out using:
newhash['pickled'] = re.sub('\n', 'linebreak', newhash['pickled'])
when catch pickled object in python, takes out linebreak , puts in \n. ajax call looks this:
$.getjson('/folder/mypython.py', {'mode':'myfunction', 'pickled':"<tmpl_var pickled escape="none">"}, function(data){
i alert right before , right after , works expected. if alert in function(data) section, nothing gets alerted. however, if take out 'pickled' key in ajax call, works fine. pickled object variables needed python calculations, not passing not option.
my pickled object looks this:
(dp0linebreaks'rlbool'linebreakp1linebreakl1llinebreakss'class7'linebreakp2linebreaks'50'linebreakp3linebreakss'fedxbool'linebreakp4linebreakl1llinebreakss'weight1'linebreakp5linebreaks'1500'linebreakp6linebreakss'conwaybool'linebreakp7linebreakl1llinebreakss'originzip'linebreakp8linebreaks'37130'linebreakp9linebreakss'company'linebreakp10linebreaks''linebreakp11linebreakss'destinationzip'linebreakp12linebreaks'37130'linebreakp13linebreakss'class6'linebreakp14linebreaks'50'linebreakp15linebreakss'mode'linebreakp16linebreaks'crawl'linebreakp17linebreakss'averitlogin'linebreakp18linebreaks'qvsinc'linebreakp19linebreakss'accessories'linebreakp20linebreak(lp21linebreakss'address'linebreakp22linebreaks'330%20robert%20rose%20blvd.'linebreakp23linebreakss'active'linebreakp24linebreakl1llinebreakss'averittbool'linebreakp25linebreakl1llinebreakss'id'linebreakp26linebreakl19llinebreakss'averitpass'linebreakp27linebreaks'meridian'linebreakp28linebreakss'shipmentdate'linebreakp29linebreaks'2010-10-08'linebreakp30linebreakss'city'linebreakp31linebreaks'murfreesboro'linebreakp32linebreakss'class5'linebreakp33linebreaks'50'linebreakp34linebreakss'last'linebreakp35linebreaks'morgan'linebreakp36linebreakss'originstate'linebreakp37linebreaks'tn'linebreakp38linebreakss'zip'linebreakp39linebreaks'37129'linebreakp40linebreakss'phone'linebreakp41linebreaks'615%20713-5432'linebreakp42linebreakss'destinationstate'linebreakp43linebreaks'tn'linebreakp44linebreakss'accessories'linebreakp45linebreak(lp46linebreakss'comments'linebreakp47linebreakg11linebreakss'estesbool'linebreakp48linebreakl1llinebreakss'origincity'linebreakp49linebreaks'murfreesboro'linebreakp50linebreakss'class8'linebreakp51linebreaks'50'linebreakp52linebreakss'state'linebreakp53linebreaks'tn'linebreakp54linebreakss'email'linebreakp55linebreaks'chris2'linebreakp56linebreakss'vitranbool'linebreakp57linebreakl1llinebreakss'saiabool'linebreakp58linebreakl1llinebreakss'destinationcity'linebreakp59linebreaks'murfreesboro'linebreakp60linebreakss'class3'linebreakp61linebreaks'50'linebreakp62linebreakss'class4'linebreakp63linebreaks'50'linebreakp64linebreakss'class1'linebreakp65linebreaks'50'linebreakp66linebreakss'class2'linebreakp67linebreaks'50'linebreakp68linebreakss'address2'linebreakp69linebreakg11linebreakss'first'linebreakp70linebreaks'chris'linebreakp71linebreaks.
i can assume there character in here ie7 has problem with.
thanks in advance help.
first, read why python pickle insecure. don't use pickled objects modified users.
instead, why not use json, made javascript. included in python >= 2.6 , available older versions. data dictionary, json should work fine.
another option base-64 encoding, shouldn't trouble special characters.
Comments
Post a Comment