Commit 9c339b84ed5a4c00e0dfee8ec7a6a8767c2fc091

  • avatar
  • arvind
  • Thu Jul 26 13:00:27 IST 2012
Test a feed
  
367367 connection.disconnect()
368368 return "empty"
369369
370
370@app.route("/demo",methods=['GET'])
371def doDemo():
372 root = lxml.html.parse(request.args['foruri']).getroot()
373 root2 = html5parser.parse(request.args['blog']).getroot()
374 tree2 = root2.getroottree()
375 if tree2.docinfo.doctype == '':
376 lxml.html.xhtml_to_html(root2)
377 root.make_links_absolute(request.args['foruri'], resolve_base_href = True)
378 root.xpath(request.args['xpath'])[0].addnext(root2.xpath(request.args['bxpath'])[0])
379 return lxml.html.tostring(root)
371380import logging,os
372381from logging import FileHandler
373382
  
11<!doctype html>
22<head>
33 <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
4 <script type="text/javascript" src="http://localhost/server/config.js"></script>
45 <script type="text/javascript">
5 $.getJSON("http://127.0.0.1:5000/feed", function(data)
6 $.getJSON(config.deploy+"/feed", function(data)
67 {
78 d = $.makeArray(data);
89 d.reverse();
2626 </script>
2727</head>
2828<body style="text-wrap:normal">
29 @<input type="text" id="t1" name="author" value="author" /> says <input type="text" id="t2" name="about" value="about" /> <input type="text" id="t3" name="xpath" value="xpath" /> has <select id="selected" onchange="checkVal();"><option>re-narrations</option><option>5el</option></select> at <input type="text" id="t4" name="blog" value="blog" /> <input type="text" id="t5" name="bxpath" value="bxpath" /> in <input type="text" name="lang" value="language" id="t6" /> <span id="remove">targetting</span> <input type="text" name="loc" value="location" id="t7"/> <input type="submit" id="post" name="alipi" value="Feed" onclick="postForm();" />
29 @<input type="text" id="t1" name="author" value="author" /> says <input type="text" id="t2" name="about" value="about" /> <input type="text" id="t3" name="xpath" value="xpath" /> has <select id="selected" onchange="checkVal();"><option>re-narrations</option><option>5el</option></select> at <input type="text" id="t4" name="blog" value="blog" /> <input type="text" id="t5" name="bxpath" value="bxpath" /> in <input type="text" name="lang" value="language" id="t6" /> <span id="remove">targetting</span> <input type="text" name="loc" value="location" id="t7"/> <input type="submit" id="post" name="alipi" value="Feed" onclick="postForm();" /> <input type="submit" name="alipi" value="Test the feed" onclick="doDemo();" />
3030<div id="feeds">
3131</div>
3232<script type="text/javascript">
5858 $("#t6").val("language");
5959 }
6060 }
61
61function doDemo()
62{
63 window.open(config.deploy+"/demo?foruri="+encodeURIComponent($('#t2').val())+"&xpath="+encodeURIComponent($('#t3').val())+"&blog="+encodeURIComponent($('#t4').val())+"&bxpath="+encodeURIComponent($('#t5').val()));
64}
6265</script>
6366</body>
6467</html>