Merge lp:~syleam/openobject-addons/5.0-improve-dms into lp:openobject-addons/5.0
- 5.0-improve-dms
- Merge into 5.0
Proposed by
Christophe CHAUVET
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~syleam/openobject-addons/5.0-improve-dms |
Merge into: | lp:openobject-addons/5.0 |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~syleam/openobject-addons/5.0-improve-dms |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+4098@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'document/__init__.py' | |||
2 | --- document/__init__.py 2009-01-04 22:12:50 +0000 | |||
3 | +++ document/__init__.py 2009-03-03 09:51:57 +0000 | |||
4 | @@ -22,3 +22,5 @@ | |||
5 | 22 | 22 | ||
6 | 23 | import document | 23 | import document |
7 | 24 | import ftpserver | 24 | import ftpserver |
8 | 25 | |||
9 | 26 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
10 | 25 | 27 | ||
11 | === modified file 'document/__terp__.py' | |||
12 | --- document/__terp__.py 2009-02-03 17:02:20 +0000 | |||
13 | +++ document/__terp__.py 2009-03-03 09:51:57 +0000 | |||
14 | @@ -45,4 +45,5 @@ | |||
15 | 45 | 'active': False, | 45 | 'active': False, |
16 | 46 | 'certificate': '0070515416461', | 46 | 'certificate': '0070515416461', |
17 | 47 | } | 47 | } |
18 | 48 | |||
19 | 48 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | 49 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
20 | 49 | 50 | ||
21 | === modified file 'document/content_index.py' | |||
22 | --- document/content_index.py 2009-01-14 07:54:20 +0000 | |||
23 | +++ document/content_index.py 2009-03-03 09:51:57 +0000 | |||
24 | @@ -1,7 +1,7 @@ | |||
25 | 1 | # -*- encoding: utf-8 -*- | 1 | # -*- encoding: utf-8 -*- |
26 | 2 | ############################################################################## | 2 | ############################################################################## |
27 | 3 | # | 3 | # |
29 | 4 | # OpenERP, Open Source Management Solution | 4 | # OpenERP, Open Source Management Solution |
30 | 5 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved | 5 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
31 | 6 | # $Id$ | 6 | # $Id$ |
32 | 7 | # | 7 | # |
33 | @@ -29,27 +29,29 @@ | |||
34 | 29 | # This should be the indexer | 29 | # This should be the indexer |
35 | 30 | # | 30 | # |
36 | 31 | def content_index(content, filename=None, content_type=None): | 31 | def content_index(content, filename=None, content_type=None): |
61 | 32 | fname,ext = os.path.splitext(filename) | 32 | fname,ext = os.path.splitext(filename) |
62 | 33 | result = '' | 33 | result = '' |
63 | 34 | if ext in ('.doc'): #or content_type ? | 34 | if ext in ('.doc'): #or content_type ? |
64 | 35 | (stdin,stdout) = os.popen2('antiword -', 'b') | 35 | (stdin,stdout) = os.popen2('antiword -', 'b') |
65 | 36 | stdin.write(content) | 36 | stdin.write(content) |
66 | 37 | stdin.close() | 37 | stdin.close() |
67 | 38 | result = stdout.read().decode('latin1','replace').encode('utf-8','replace') | 38 | result = stdout.read().decode('latin1','replace').encode('utf-8','replace') |
68 | 39 | elif ext == '.pdf': | 39 | elif ext == '.pdf': |
69 | 40 | file_descriptor, file_name = tempfile.mkstemp(suffix=ext) | 40 | file_descriptor, file_name = tempfile.mkstemp(suffix=ext) |
70 | 41 | os.write(file_descriptor, content) | 41 | os.write(file_descriptor, content) |
71 | 42 | os.close(file_descriptor) | 42 | os.close(file_descriptor) |
72 | 43 | fp = os.popen('pdftotext -enc UTF-8 -nopgbrk '+file_name+' -', 'r') | 43 | fp = os.popen('pdftotext -enc UTF-8 -nopgbrk '+file_name+' -', 'r') |
73 | 44 | result = fp.read() | 44 | result = fp.read() |
74 | 45 | fp.close() | 45 | fp.close() |
75 | 46 | elif ext in ('.xls','.ods','.odt','.odp'): | 46 | elif ext in ('.xls','.ods','.odt','.odp'): |
76 | 47 | s = StringIO.StringIO(content) | 47 | s = StringIO.StringIO(content) |
77 | 48 | o = odt2txt.OpenDocumentTextFile(s) | 48 | o = odt2txt.OpenDocumentTextFile(s) |
78 | 49 | result = o.toString().encode('ascii','replace') | 49 | result = o.toString().encode('ascii','replace') |
79 | 50 | s.close() | 50 | s.close() |
80 | 51 | elif ext in ('.txt','.py','.patch','.html','.csv','.xml'): | 51 | elif ext in ('.txt','.py','.patch','.html','.csv','.xml'): |
81 | 52 | result = content | 52 | result = content |
82 | 53 | else: | 53 | else: |
83 | 54 | result = content | 54 | result = content |
84 | 55 | return result | 55 | return result |
85 | 56 | |||
86 | 57 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
87 | 56 | 58 | ||
88 | === modified file 'document/document.py' | |||
89 | --- document/document.py 2009-02-05 17:30:32 +0000 | |||
90 | +++ document/document.py 2009-03-03 09:51:57 +0000 | |||
91 | @@ -41,7 +41,7 @@ | |||
92 | 41 | 41 | ||
93 | 42 | def random_name(): | 42 | def random_name(): |
94 | 43 | random.seed() | 43 | random.seed() |
96 | 44 | d = [random.choice(string.letters) for x in xrange(10) ] | 44 | d = [random.choice(string.ascii_letters) for x in xrange(10) ] |
97 | 45 | name = "".join(d) | 45 | name = "".join(d) |
98 | 46 | return name | 46 | return name |
99 | 47 | 47 | ||
100 | @@ -492,11 +492,11 @@ | |||
101 | 492 | result = {} | 492 | result = {} |
102 | 493 | cr.execute('select id,store_fname,link from ir_attachment where id in ('+','.join(map(str,ids))+')') | 493 | cr.execute('select id,store_fname,link from ir_attachment where id in ('+','.join(map(str,ids))+')') |
103 | 494 | for id,r,l in cr.fetchall(): | 494 | for id,r,l in cr.fetchall(): |
109 | 495 | try: | 495 | try: |
110 | 496 | value = file(os.path.join(self._get_filestore(cr), r), 'rb').read() | 496 | value = file(os.path.join(self._get_filestore(cr), r), 'rb').read() |
111 | 497 | result[id] = base64.encodestring(value) | 497 | result[id] = base64.encodestring(value) |
112 | 498 | except: | 498 | except: |
113 | 499 | result[id]='' | 499 | result[id]='' |
114 | 500 | 500 | ||
115 | 501 | if context.get('bin_size', False): | 501 | if context.get('bin_size', False): |
116 | 502 | result[id] = tools.human_size(len(result[id])) | 502 | result[id] = tools.human_size(len(result[id])) |
117 | @@ -581,7 +581,7 @@ | |||
118 | 581 | res_id=file.res_id and file.res_id or 0 | 581 | res_id=file.res_id and file.res_id or 0 |
119 | 582 | res=self.search(cr,uid,[('id','<>',file.id),('name','=',name),('parent_id','=',parent_id),('res_model','=',res_model),('res_id','=',res_id)]) | 582 | res=self.search(cr,uid,[('id','<>',file.id),('name','=',name),('parent_id','=',parent_id),('res_model','=',res_model),('res_id','=',res_id)]) |
120 | 583 | if len(res): | 583 | if len(res): |
122 | 584 | return False | 584 | return False |
123 | 585 | if op=='create': | 585 | if op=='create': |
124 | 586 | res=self.search(cr,uid,[('name','=',name),('parent_id','=',parent_id),('res_id','=',res_id),('res_model','=',res_model)]) | 586 | res=self.search(cr,uid,[('name','=',name),('parent_id','=',parent_id),('res_id','=',res_id),('res_model','=',res_model)]) |
125 | 587 | if len(res): | 587 | if len(res): |
126 | @@ -771,3 +771,5 @@ | |||
127 | 771 | 'target':'new', | 771 | 'target':'new', |
128 | 772 | } | 772 | } |
129 | 773 | document_configuration_wizard() | 773 | document_configuration_wizard() |
130 | 774 | |||
131 | 775 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
132 | 774 | 776 | ||
133 | === modified file 'document/ftpserver/__init__.py' | |||
134 | --- document/ftpserver/__init__.py 2008-12-18 08:55:57 +0000 | |||
135 | +++ document/ftpserver/__init__.py 2009-03-03 09:51:57 +0000 | |||
136 | @@ -1,3 +1,25 @@ | |||
137 | 1 | # -*- encoding: utf-8 -*- | ||
138 | 2 | ############################################################################## | ||
139 | 3 | # | ||
140 | 4 | # OpenERP, Open Source Management Solution | ||
141 | 5 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved | ||
142 | 6 | # $Id$ | ||
143 | 7 | # | ||
144 | 8 | # This program is free software: you can redistribute it and/or modify | ||
145 | 9 | # it under the terms of the GNU General Public License as published by | ||
146 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
147 | 11 | # (at your option) any later version. | ||
148 | 12 | # | ||
149 | 13 | # This program is distributed in the hope that it will be useful, | ||
150 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
151 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
152 | 16 | # GNU General Public License for more details. | ||
153 | 17 | # | ||
154 | 18 | # You should have received a copy of the GNU General Public License | ||
155 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
156 | 20 | # | ||
157 | 21 | ############################################################################## | ||
158 | 22 | |||
159 | 1 | import threading | 23 | import threading |
160 | 2 | import ftpserver | 24 | import ftpserver |
161 | 3 | import authorizer | 25 | import authorizer |
162 | @@ -31,3 +53,4 @@ | |||
163 | 31 | ds = ftp_server() | 53 | ds = ftp_server() |
164 | 32 | ds.start() | 54 | ds.start() |
165 | 33 | 55 | ||
166 | 56 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
167 | 34 | 57 | ||
168 | === modified file 'document/ftpserver/abstracted_fs.py' | |||
169 | --- document/ftpserver/abstracted_fs.py 2009-01-02 06:00:20 +0000 | |||
170 | +++ document/ftpserver/abstracted_fs.py 2009-03-03 09:51:57 +0000 | |||
171 | @@ -1,3 +1,25 @@ | |||
172 | 1 | # -*- encoding: utf-8 -*- | ||
173 | 2 | ############################################################################## | ||
174 | 3 | # | ||
175 | 4 | # OpenERP, Open Source Management Solution | ||
176 | 5 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved | ||
177 | 6 | # $Id$ | ||
178 | 7 | # | ||
179 | 8 | # This program is free software: you can redistribute it and/or modify | ||
180 | 9 | # it under the terms of the GNU General Public License as published by | ||
181 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
182 | 11 | # (at your option) any later version. | ||
183 | 12 | # | ||
184 | 13 | # This program is distributed in the hope that it will be useful, | ||
185 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
186 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
187 | 16 | # GNU General Public License for more details. | ||
188 | 17 | # | ||
189 | 18 | # You should have received a copy of the GNU General Public License | ||
190 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
191 | 20 | # | ||
192 | 21 | ############################################################################## | ||
193 | 22 | |||
194 | 1 | import os | 23 | import os |
195 | 2 | import time | 24 | import time |
196 | 3 | from tarfile import filemode | 25 | from tarfile import filemode |
197 | @@ -788,3 +810,4 @@ | |||
198 | 788 | yield "%s%s%s%s%s%s%s%s%s %s\r\n" %(type, size, perm, modify, create, | 810 | yield "%s%s%s%s%s%s%s%s%s %s\r\n" %(type, size, perm, modify, create, |
199 | 789 | mode, uid, gid, unique, basename) | 811 | mode, uid, gid, unique, basename) |
200 | 790 | 812 | ||
201 | 813 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
202 | 791 | 814 | ||
203 | === modified file 'document/ftpserver/authorizer.py' | |||
204 | --- document/ftpserver/authorizer.py 2008-10-29 21:45:02 +0000 | |||
205 | +++ document/ftpserver/authorizer.py 2009-03-03 09:51:57 +0000 | |||
206 | @@ -1,3 +1,25 @@ | |||
207 | 1 | # -*- encoding: utf-8 -*- | ||
208 | 2 | ############################################################################## | ||
209 | 3 | # | ||
210 | 4 | # OpenERP, Open Source Management Solution | ||
211 | 5 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved | ||
212 | 6 | # $Id$ | ||
213 | 7 | # | ||
214 | 8 | # This program is free software: you can redistribute it and/or modify | ||
215 | 9 | # it under the terms of the GNU General Public License as published by | ||
216 | 10 | # the Free Software Foundation, either version 3 of the License, or | ||
217 | 11 | # (at your option) any later version. | ||
218 | 12 | # | ||
219 | 13 | # This program is distributed in the hope that it will be useful, | ||
220 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
221 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
222 | 16 | # GNU General Public License for more details. | ||
223 | 17 | # | ||
224 | 18 | # You should have received a copy of the GNU General Public License | ||
225 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
226 | 20 | # | ||
227 | 21 | ############################################################################## | ||
228 | 22 | |||
229 | 1 | #import pooler | 23 | #import pooler |
230 | 2 | 24 | ||
231 | 3 | class authorizer: | 25 | class authorizer: |
232 | @@ -68,4 +90,4 @@ | |||
233 | 68 | """Return the user's quitting message.""" | 90 | """Return the user's quitting message.""" |
234 | 69 | return 'Bye.' | 91 | return 'Bye.' |
235 | 70 | 92 | ||
237 | 71 | 93 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | |
238 | 72 | 94 | ||
239 | === modified file 'document/ftpserver/ftpserver.py' | |||
240 | --- document/ftpserver/ftpserver.py 2008-12-18 08:55:57 +0000 | |||
241 | +++ document/ftpserver/ftpserver.py 2009-03-03 09:51:57 +0000 | |||
242 | @@ -1,4 +1,5 @@ | |||
243 | 1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python |
244 | 2 | # -*- encoding: utf-8 -*- | ||
245 | 2 | # ftpserver.py | 3 | # ftpserver.py |
246 | 3 | # | 4 | # |
247 | 4 | # pyftpdlib is released under the MIT license, reproduced below: | 5 | # pyftpdlib is released under the MIT license, reproduced below: |
248 | @@ -3094,3 +3095,5 @@ | |||
249 | 3094 | 3095 | ||
250 | 3095 | if __name__ == '__main__': | 3096 | if __name__ == '__main__': |
251 | 3096 | test() | 3097 | test() |
252 | 3098 | |||
253 | 3099 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
254 | 3097 | 3100 | ||
255 | === modified file 'document/odt2txt.py' | |||
256 | --- document/odt2txt.py 2009-01-04 22:12:50 +0000 | |||
257 | +++ document/odt2txt.py 2009-03-03 09:51:57 +0000 | |||
258 | @@ -2,7 +2,7 @@ | |||
259 | 2 | # -*- encoding: utf-8 -*- | 2 | # -*- encoding: utf-8 -*- |
260 | 3 | ############################################################################## | 3 | ############################################################################## |
261 | 4 | # | 4 | # |
263 | 5 | # OpenERP, Open Source Management Solution | 5 | # OpenERP, Open Source Management Solution |
264 | 6 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved | 6 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
265 | 7 | # $Id$ | 7 | # $Id$ |
266 | 8 | # | 8 | # |
267 | @@ -25,28 +25,30 @@ | |||
268 | 25 | import StringIO | 25 | import StringIO |
269 | 26 | 26 | ||
270 | 27 | class OpenDocumentTextFile : | 27 | class OpenDocumentTextFile : |
291 | 28 | def __init__ (self, filepath) : | 28 | def __init__ (self, filepath) : |
292 | 29 | zip = zipfile.ZipFile(filepath) | 29 | zip = zipfile.ZipFile(filepath) |
293 | 30 | self.content = xml.dom.minidom.parseString(zip.read("content.xml")) | 30 | self.content = xml.dom.minidom.parseString(zip.read("content.xml")) |
294 | 31 | 31 | ||
295 | 32 | def toString (self) : | 32 | def toString (self) : |
296 | 33 | """ Converts the document to a string. """ | 33 | """ Converts the document to a string. """ |
297 | 34 | buffer = u"" | 34 | buffer = u"" |
298 | 35 | for val in ["text:p", "text:h", "text:list"]: | 35 | for val in ["text:p", "text:h", "text:list"]: |
299 | 36 | for paragraph in self.content.getElementsByTagName(val) : | 36 | for paragraph in self.content.getElementsByTagName(val) : |
300 | 37 | buffer += self.textToString(paragraph) + "\n" | 37 | buffer += self.textToString(paragraph) + "\n" |
301 | 38 | return buffer | 38 | return buffer |
302 | 39 | 39 | ||
303 | 40 | def textToString(self, element) : | 40 | def textToString(self, element) : |
304 | 41 | buffer = u"" | 41 | buffer = u"" |
305 | 42 | for node in element.childNodes : | 42 | for node in element.childNodes : |
306 | 43 | if node.nodeType == xml.dom.Node.TEXT_NODE : | 43 | if node.nodeType == xml.dom.Node.TEXT_NODE : |
307 | 44 | buffer += node.nodeValue | 44 | buffer += node.nodeValue |
308 | 45 | elif node.nodeType == xml.dom.Node.ELEMENT_NODE : | 45 | elif node.nodeType == xml.dom.Node.ELEMENT_NODE : |
309 | 46 | buffer += self.textToString(node) | 46 | buffer += self.textToString(node) |
310 | 47 | return buffer | 47 | return buffer |
311 | 48 | 48 | ||
312 | 49 | if __name__ == "__main__" : | 49 | if __name__ == "__main__" : |
316 | 50 | s =StringIO.StringIO(file(sys.argv[1]).read()) | 50 | s =StringIO.StringIO(file(sys.argv[1]).read()) |
317 | 51 | odt = OpenDocumentTextFile(s) | 51 | odt = OpenDocumentTextFile(s) |
318 | 52 | print odt.toString().encode('ascii','replace') | 52 | print odt.toString().encode('ascii','replace') |
319 | 53 | |||
320 | 54 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
321 | 53 | 55 | ||
322 | === modified file 'document_ics/__init__.py' | |||
323 | --- document_ics/__init__.py 2009-01-04 22:12:50 +0000 | |||
324 | +++ document_ics/__init__.py 2009-03-03 09:51:57 +0000 | |||
325 | @@ -21,3 +21,5 @@ | |||
326 | 21 | ############################################################################## | 21 | ############################################################################## |
327 | 22 | 22 | ||
328 | 23 | import document | 23 | import document |
329 | 24 | |||
330 | 25 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
Correct the bug 333223