
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2019-03-07 18:57 byBernt.Røskar.Brenna, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 12225 | merged | Bernt.Røskar.Brenna,2019-03-07 19:10 | |
| Messages (9) | |||
|---|---|---|---|
| msg337428 -(view) | Author: Bernt Røskar Brenna (Bernt.Røskar.Brenna)* | Date: 2019-03-07 18:57 | |
default_namespace is often used when serializing ET elements. tostring() is mainly a wrapper around ElementTree.write(), and it is therefore natural that it mirrors write's argument. tostring() already passes encoding, method and short_empty_elements to write. | |||
| msg337455 -(view) | Author: Stefan Behnel (scoder)*![]() | Date: 2019-03-08 08:37 | |
The feature seems reasonable to me and the patch looks good. | |||
| msg337456 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2019-03-08 08:50 | |
See alsoissue31256.I do not know what is better: make tostring() to accept all options of write(), or keep it simpler. What strategy lxml supports? | |||
| msg337458 -(view) | Author: Stefan Behnel (scoder)*![]() | Date: 2019-03-08 08:58 | |
lxml does not support the "default_namespace" option specifically (because its tree model preserves namespace prefixes), but it generally makes all (justifiable) serialisation options available to both tostring() and ET.write().I think the same should apply to ElementTree. Both the "default_namespace" and "doctype" options seem useful regardless of the serialisation target. | |||
| msg337460 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2019-03-08 09:51 | |
Okay. Bernt, do you mind to add also the xml_declaration option inPR 12225 or create a separate PR forissue31256? | |||
| msg337473 -(view) | Author: Bernt Røskar Brenna (Bernt.Røskar.Brenna)* | Date: 2019-03-08 13:28 | |
I will add xml_declaration and push to the existing PR. | |||
| msg337478 -(view) | Author: Bernt Røskar Brenna (Bernt.Røskar.Brenna)* | Date: 2019-03-08 14:02 | |
I pushed changes to the PR. I also added xml_declaration and default_namespace to the tostringlist() method. | |||
| msg340190 -(view) | Author: Stefan Behnel (scoder)*![]() | Date: 2019-04-14 08:07 | |
New changesetffca16e25a70fd44a87b13b379b5ec0c7a11e926 by Stefan Behnel (Bernt Røskar Brenna) in branch 'master':bpo-36227: ElementTree.tostring() default_namespace and xml_declaration arguments (GH-12225)https://github.com/python/cpython/commit/ffca16e25a70fd44a87b13b379b5ec0c7a11e926 | |||
| msg340193 -(view) | Author: Stefan Behnel (scoder)*![]() | Date: 2019-04-14 08:16 | |
Thank you for you contribution. | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:12 | admin | set | github: 80408 |
| 2019-04-14 08:16:04 | scoder | set | status: open -> closed messages: +msg340193 components: + XML resolution: fixed stage: patch review -> resolved |
| 2019-04-14 08:07:16 | scoder | set | messages: +msg340190 |
| 2019-03-08 14:02:12 | Bernt.Røskar.Brenna | set | messages: +msg337478 |
| 2019-03-08 13:28:32 | Bernt.Røskar.Brenna | set | messages: +msg337473 |
| 2019-03-08 09:51:18 | serhiy.storchaka | set | messages: +msg337460 |
| 2019-03-08 08:58:56 | scoder | set | messages: +msg337458 |
| 2019-03-08 08:50:51 | serhiy.storchaka | set | messages: +msg337456 |
| 2019-03-08 08:37:57 | scoder | set | messages: +msg337455 |
| 2019-03-08 03:06:25 | xtreak | set | nosy: +scoder,eli.bendersky,serhiy.storchaka |
| 2019-03-07 19:10:22 | Bernt.Røskar.Brenna | set | keywords: +patch stage: patch review pull_requests: +pull_request12215 |
| 2019-03-07 18:57:14 | Bernt.Røskar.Brenna | create | |