Merge lp:~pascal-bach/openobject-addons/remove-pyxml into lp:openobject-addons

Proposed by Pascal Bach
Status: Rejected
Rejected by: Xavier (Open ERP)
Proposed branch: lp:~pascal-bach/openobject-addons/remove-pyxml
Merge into: lp:openobject-addons
Diff against target: 310 lines (+28/-74)
6 files modified
base_calendar/DAV/davcopy.py (+3/-9)
base_calendar/DAV/propfind.py (+5/-15)
base_calendar/DAV/utils.py (+6/-13)
document_webdav/DAV/davcopy.py (+3/-9)
document_webdav/DAV/propfind.py (+5/-15)
document_webdav/DAV/utils.py (+6/-13)
To merge this branch: bzr merge lp:~pascal-bach/openobject-addons/remove-pyxml
Reviewer Review Type Date Requested Status
Xavier (Open ERP) (community) Approve
Christophe CHAUVET (community) Disapprove
Review via email: mp+19054@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Pascal Bach (pascal-bach) wrote :

Replaced all the usages of xml.dom.ext module, which depends on pyXML with the xml.dom.minidom module which is included in Python since 2.0.

This makes openerp work on Ubuntu 8.04 and later, because they do no longer provide packages for pyXML.

Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

Hi

minidom have poor performance, OpenERP use lxml to parse Report, view, etc.

Can you convert to use lxml ?

Regards,

Christophe.

review: Disapprove
Revision history for this message
Pascal Bach (pascal-bach) wrote :

I have no experience with lxml but I will have a look at it and see if it is possible.

Regards,
Pascal

Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

I agree with Christophe that lxml would be much better. On the other hand, removing python-xml is always a good idea.

review: Approve
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

Considering base_calendar has been deprecated and moved to extra addons, I don't think there's any point in this merge prop, sorry about that.

Unmerged revisions

2979. By Pascal Bach

Replace xml.dom.ext with xml.dom.minidom to replace pyXML in base_calendar and document_webdav

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'base_calendar/DAV/davcopy.py'
2--- base_calendar/DAV/davcopy.py 2010-02-01 13:54:53 +0000
3+++ base_calendar/DAV/davcopy.py 2010-02-10 21:35:30 +0000
4@@ -22,14 +22,12 @@
5 """
6
7
8-from xml.dom import ext
9-from xml.dom.Document import Document
10+from xml.dom.minidom import Document
11
12 import sys
13 import string
14 import urlparse
15 import urllib
16-from StringIO import StringIO
17
18 import utils
19 from constants import COLLECTION, OBJECT, DAV_PROPS, RT_ALLPROP, RT_PROPNAME, RT_PROP
20@@ -108,7 +106,7 @@
21 ### we might make a common method out of it)
22 ###
23
24- doc = Document(None)
25+ doc = Document()
26 ms=doc.createElement("D:multistatus")
27 ms.setAttribute("xmlns:D","DAV:")
28 doc.appendChild(ms)
29@@ -125,9 +123,5 @@
30 re.appendChild(st)
31 ms.appendChild(re)
32
33- sfile=StringIO()
34- ext.PrettyPrint(doc,stream=sfile)
35- s=sfile.getvalue()
36- sfile.close()
37- return s
38+ return doc.toprettyxml()
39
40
41=== modified file 'base_calendar/DAV/propfind.py'
42--- base_calendar/DAV/propfind.py 2010-02-01 13:54:53 +0000
43+++ base_calendar/DAV/propfind.py 2010-02-10 21:35:30 +0000
44@@ -21,14 +21,12 @@
45 """
46
47
48-from xml.dom import ext
49-from xml.dom.Document import Document
50+from xml.dom.minidom import Document
51
52 import sys
53 import string
54 import urlparse
55 import urllib
56-from StringIO import StringIO
57
58 import utils
59 from constants import COLLECTION, OBJECT, DAV_PROPS, RT_ALLPROP, RT_PROPNAME, RT_PROP
60@@ -116,7 +114,7 @@
61
62 dc=self.__dataclass
63 # create the document generator
64- doc = Document(None)
65+ doc = Document()
66 ms=doc.createElement("D:multistatus")
67 ms.setAttribute("xmlns:D","DAV:")
68 doc.appendChild(ms)
69@@ -137,11 +135,7 @@
70 ms.appendChild(re)
71 # *** depth=="infinity"
72
73- sfile=StringIO()
74- ext.PrettyPrint(doc,stream=sfile)
75- s=sfile.getvalue()
76- sfile.close()
77- return s
78+ return doc.toprettyxml()
79
80 def create_allprop(self):
81 """ return a list of all properties """
82@@ -177,7 +171,7 @@
83
84
85 # create the document generator
86- doc = Document(None)
87+ doc = Document()
88 ms=doc.createElement("D:multistatus")
89 ms.setAttribute("xmlns:D","DAV:")
90 doc.appendChild(ms)
91@@ -201,11 +195,7 @@
92 # If no children, never mind.
93 pass
94
95- sfile=StringIO()
96- ext.PrettyPrint(doc,stream=sfile)
97- s=sfile.getvalue()
98- sfile.close()
99- return s
100+ return doc.toprettyxml()
101
102
103 def mk_propname_response(self,uri,propnames,doc):
104
105=== modified file 'base_calendar/DAV/utils.py'
106--- base_calendar/DAV/utils.py 2010-02-01 13:54:53 +0000
107+++ base_calendar/DAV/utils.py 2010-02-10 21:35:30 +0000
108@@ -8,15 +8,12 @@
109
110 """
111
112-from xml.dom import ext
113-from xml.dom.Document import Document
114-from xml.dom.ext.reader import PyExpat
115-from xml.dom import Node
116-from xml.dom import NodeIterator, NodeFilter
117+from xml.dom.minidom import parseString
118+from xml.dom.minidom import Document
119+from xml.dom.minidom import Node
120
121 from string import lower, split, atoi, joinfields
122 import urlparse
123-from StringIO import StringIO
124
125 from constants import RT_ALLPROP, RT_PROPNAME, RT_PROP
126 from status import STATUS_CODES
127@@ -43,7 +40,7 @@
128 namespaces -- list of namespaces found
129
130 """
131- doc = PyExpat.Reader().fromString(xml_doc)
132+ doc = parseString(xml_doc)
133 snit = doc.createNodeIterator(doc, NodeFilter.NodeFilter.SHOW_ELEMENT, None, None)
134
135 request_type=None
136@@ -135,7 +132,7 @@
137
138 def make_xmlresponse(result):
139 """ construct a response from a dict of uri:error_code elements """
140- doc = Document(None)
141+ doc = Document()
142 ms=doc.createElement("D:multistatus")
143 ms.setAttribute("xmlns:D","DAV:")
144 doc.appendChild(ms)
145@@ -152,9 +149,5 @@
146 re.appendChild(st)
147 ms.appendChild(re)
148
149- sfile=StringIO()
150- ext.PrettyPrint(doc,stream=sfile)
151- s=sfile.getvalue()
152- sfile.close()
153- return s
154+ return doc.toprettyxml()
155
156
157=== modified file 'document_webdav/DAV/davcopy.py'
158--- document_webdav/DAV/davcopy.py 2009-11-05 19:54:33 +0000
159+++ document_webdav/DAV/davcopy.py 2010-02-10 21:35:30 +0000
160@@ -22,14 +22,12 @@
161 """
162
163
164-from xml.dom import ext
165-from xml.dom.Document import Document
166+from xml.dom.minidom import Document
167
168 import sys
169 import string
170 import urlparse
171 import urllib
172-from StringIO import StringIO
173
174 import utils
175 from constants import COLLECTION, OBJECT, DAV_PROPS, RT_ALLPROP, RT_PROPNAME, RT_PROP
176@@ -108,7 +106,7 @@
177 ### we might make a common method out of it)
178 ###
179
180- doc = Document(None)
181+ doc = Document()
182 ms=doc.createElement("D:multistatus")
183 ms.setAttribute("xmlns:D","DAV:")
184 doc.appendChild(ms)
185@@ -125,9 +123,5 @@
186 re.appendChild(st)
187 ms.appendChild(re)
188
189- sfile=StringIO()
190- ext.PrettyPrint(doc,stream=sfile)
191- s=sfile.getvalue()
192- sfile.close()
193- return s
194+ return doc.toprettyxml()
195
196
197=== modified file 'document_webdav/DAV/propfind.py'
198--- document_webdav/DAV/propfind.py 2009-11-05 21:34:32 +0000
199+++ document_webdav/DAV/propfind.py 2010-02-10 21:35:30 +0000
200@@ -21,14 +21,12 @@
201 """
202
203
204-from xml.dom import ext
205-from xml.dom.Document import Document
206+from xml.dom.minidom import Document
207
208 import sys
209 import string
210 import urlparse
211 import urllib
212-from StringIO import StringIO
213
214 import utils
215 from constants import COLLECTION, OBJECT, DAV_PROPS, RT_ALLPROP, RT_PROPNAME, RT_PROP
216@@ -116,7 +114,7 @@
217
218 dc=self.__dataclass
219 # create the document generator
220- doc = Document(None)
221+ doc = Document()
222 ms=doc.createElement("D:multistatus")
223 ms.setAttribute("xmlns:D","DAV:")
224 doc.appendChild(ms)
225@@ -137,11 +135,7 @@
226 ms.appendChild(re)
227 # *** depth=="infinity"
228
229- sfile=StringIO()
230- ext.PrettyPrint(doc,stream=sfile)
231- s=sfile.getvalue()
232- sfile.close()
233- return s
234+ return doc.toprettyxml()
235
236 def create_allprop(self):
237 """ return a list of all properties """
238@@ -177,7 +171,7 @@
239
240
241 # create the document generator
242- doc = Document(None)
243+ doc = Document()
244 ms=doc.createElement("D:multistatus")
245 ms.setAttribute("xmlns:D","DAV:")
246 doc.appendChild(ms)
247@@ -201,11 +195,7 @@
248 # If no children, never mind.
249 pass
250
251- sfile=StringIO()
252- ext.PrettyPrint(doc,stream=sfile)
253- s=sfile.getvalue()
254- sfile.close()
255- return s
256+ return doc.toprettyxml()
257
258
259 def mk_propname_response(self,uri,propnames,doc):
260
261=== modified file 'document_webdav/DAV/utils.py'
262--- document_webdav/DAV/utils.py 2009-12-17 11:56:04 +0000
263+++ document_webdav/DAV/utils.py 2010-02-10 21:35:30 +0000
264@@ -8,15 +8,12 @@
265
266 """
267
268-from xml.dom import ext
269-from xml.dom.Document import Document
270-from xml.dom.ext.reader import PyExpat
271-from xml.dom import Node
272-from xml.dom import NodeIterator, NodeFilter
273+from xml.dom.minidom import parseString
274+from xml.dom.minidom import Document
275+from xml.dom.minidom import Node
276
277 from string import lower, split, atoi, joinfields
278 import urlparse
279-from StringIO import StringIO
280
281 from constants import RT_ALLPROP, RT_PROPNAME, RT_PROP
282 from status import STATUS_CODES
283@@ -43,7 +40,7 @@
284 namespaces -- list of namespaces found
285
286 """
287- doc = PyExpat.Reader().fromString(xml_doc)
288+ doc = parseString(xml_doc)
289 snit = doc.createNodeIterator(doc, NodeFilter.NodeFilter.SHOW_ELEMENT, None, None)
290
291 request_type=None
292@@ -135,7 +132,7 @@
293
294 def make_xmlresponse(result):
295 """ construct a response from a dict of uri:error_code elements """
296- doc = Document(None)
297+ doc = Document()
298 ms=doc.createElement("D:multistatus")
299 ms.setAttribute("xmlns:D","DAV:")
300 doc.appendChild(ms)
301@@ -152,9 +149,5 @@
302 re.appendChild(st)
303 ms.appendChild(re)
304
305- sfile=StringIO()
306- ext.PrettyPrint(doc,stream=sfile)
307- s=sfile.getvalue()
308- sfile.close()
309- return s
310+ return doc.toprettyxml()
311

Subscribers

People subscribed via source and target branches

to all changes: