Re: [web2py] webp2y XML helper sanitize line breaks under python3.6

2020-02-13 Thread Christian Varas
Great! El El jue, 13 de feb. de 2020 a la(s) 09:22, Clemens < clemens.odend...@claret-clover.de> escribió: > Tim Nyborg has got the solution: > It's a bug in yatl/sanitizer.py, which can be fixed as described: > >

Re: [web2py] webp2y XML helper sanitize line breaks under python3.6

2020-02-13 Thread Clemens
Tim Nyborg has got the solution: It's a bug in yatl/sanitizer.py, which can be fixed as described: https://stackoverflow.com/questions/60176267/webp2y-xml-helper-sanitize-line-breaks-under-python3 Thanks Tim! On Wednesday, February 12, 2020 at 5:17:31 PM UTC+1, Clemens wrote: > > Hi Chris, > >

Re: [web2py] webp2y XML helper sanitize line breaks under python3.6

2020-02-12 Thread Clemens
Hi Chris, thanks a lot for your help! But the problem still exists even replacing my str_replace routine by str.replace() as proposed by you. Yes, I had the same problem with line breaks crashing the view. And replacing the line breaks by fixed it. But switching form python 2.7 to 3.6 raises

Re: [web2py] webp2y XML helper sanitize line breaks under python3.6

2020-02-12 Thread Christian Varas
Hi Clemens, Replace can handle big text it does not matter if is 1 - 1000 lines or more, It will replace all the occurrences in the text, also is faster. chaining "replace" is more faster than other methods. description = his_item.description.replace("\n","").replace("\r","

Re: [web2py] webp2y XML helper sanitize line breaks under python3.6

2020-02-12 Thread Clemens
Hello Chris, thanks for your answer! But just kicking out all line breaks is a little harsh, since in my case the description is mostly a few lines long with 2 or 3 paragraphs. And I had the problem already solved by this procedure and the call as described in my question: def

Re: [web2py] webp2y XML helper sanitize line breaks under python3.6

2020-02-12 Thread Christian Varas
I had an issue with line breaks too, I remove lie breaks like this with python 3.7 some_string = some_string.replace(“\n”, ””).replace(“\r”, ””) XML(some_string, sanitize=True) Cheers Chris El El mié, 12 de feb. de 2020 a la(s) 04:37, Clemens < clemens.odend...@claret-clover.de> escribió: >

[web2py] webp2y XML helper sanitize line breaks under python3.6

2020-02-11 Thread Clemens
Hello! In my web2py app I’m processing a list of items, where the user can click on a link for each item to select this. An item has an UUID, a title and a description. For a better orientation the item description is also displayed as link title. To prevent injections by and to escape tags in