File: no-et-roundtrip

package info (click to toggle)
python-wadllib 1.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 616 kB
  • sloc: xml: 3,484; python: 902; makefile: 23
file content (25 lines) | stat: -rw-r--r-- 1,064 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Description: Don't roundtrip through ET, losing namespaces
 Roundtripping through ET was losing the namespace information, causing
 datetimes to be returned as strings.
Forwarded: https://code.launchpad.net/~stefanor/wadllib/datetime-924240/+merge/97099
Author: Stefano Rivera <stefanor@debian.org>
Last-Update: 2012-03-22

--- a/src/wadllib/application.py
+++ b/src/wadllib/application.py
@@ -1104,13 +1104,8 @@
         return ET.ElementTree(root)
 
     def _from_string(self, markup):
-        """Turns markup into a document.
-
-        Just a wrapper around ElementTree which keeps track of namespaces.
-        """
-        # We're using the ET fromstring/tostring to help make sure we maintain
-        # py2/3 compatiblity and keeping things in Unicode.
-        return self._from_stream(BytesIO(ET.tostring(ET.fromstring(markup))))
+        """Turns markup into a document."""
+        return self._from_stream(BytesIO(markup))
 
     def get_resource_type(self, resource_type_url):
         """Retrieve a resource type by the URL of its description."""