Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #67315
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'insert': 0.05; 'discard': 0.07; 'element': 0.07; 'ugly': 0.07; 'string': 0.09; 'converted': 0.09; 'inserted': 0.09; 'parsing': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:into': 0.09; 'subject:parsing': 0.09; 'chunks': 0.16; 'files:': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'unsafe': 0.16; 'possible,': 0.19; 'stefan': 0.19; 'this?': 0.23; 'header:User-Agent:1': 0.23; 'necessary.': 0.24; 'parse': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'page.': 0.31; 'safely': 0.31; 'open': 0.33; '(e.g.': 0.33; 'created': 0.35; 'tool': 0.35; 'something': 0.35; 'received:84': 0.35; 'building': 0.35; 'there': 0.35; 'doing': 0.36; 'example,': 0.37; 'to:addr:python-list': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'is.': 0.60; 'potentially': 0.81; 'received:arcor-ip.net': 0.84; 'received:pools.arcor-ip.net': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Stefan Behnel <stefan_ml@behnel.de> |
| Subject | Re: insert html into ElementTree without parsing it |
| Date | Sat, 01 Mar 2014 15:26:09 +0100 |
| References | <b7c05dd5-d25f-428e-b1d5-2ab75ab451f8@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | dslb-084-056-060-236.pools.arcor-ip.net |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
| In-Reply-To | <b7c05dd5-d25f-428e-b1d5-2ab75ab451f8@googlegroups.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.7513.1393683982.18130.python-list@python.org> (permalink) |
| Lines | 19 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1393683982 news.xs4all.nl 2912 [2001:888:2000:d::a6]:40592 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:67315 |
Show key headers only | View raw
graeme.pietersz@gmail.com, 24.02.2014 10:45: > I am building HTML pages using ElementTree. > I need to insert chunks of untrusted HTML into the page. I do not need or want to parse this, just insert it at a particular point as is. How would you want to find out if it can be safely inserted or not without parsing it? > The best solutions I can think of are rather ugly ones: manipulating the string created by tostring. > > Is there a nicer way of doing this? Is it possible, for example, to customise how an element is converted to a string representation? I am open to using something else (e.g. lxml) if necessary. lxml has a tool to discard potentially unsafe content from HTML files: http://lxml.de/lxmlhtml.html#cleaning-up-html Stefan
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
insert html into ElementTree without parsing it graeme.pietersz@gmail.com - 2014-02-24 01:45 -0800 Re: insert html into ElementTree without parsing it Stefan Behnel <stefan_ml@behnel.de> - 2014-03-01 15:26 +0100
csiph-web