Merge lp:~syleam/openobject-addons/5.0-improve-dms into lp:openobject-addons/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
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+4098@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

Correct the bug 333223

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'document/__init__.py'
--- document/__init__.py 2009-01-04 22:12:50 +0000
+++ document/__init__.py 2009-03-03 09:51:57 +0000
@@ -22,3 +22,5 @@
2222
23import document23import document
24import ftpserver24import ftpserver
25
26# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2527
=== modified file 'document/__terp__.py'
--- document/__terp__.py 2009-02-03 17:02:20 +0000
+++ document/__terp__.py 2009-03-03 09:51:57 +0000
@@ -45,4 +45,5 @@
45 'active': False,45 'active': False,
46 'certificate': '0070515416461',46 'certificate': '0070515416461',
47}47}
48
48# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:49# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
4950
=== modified file 'document/content_index.py'
--- document/content_index.py 2009-01-14 07:54:20 +0000
+++ document/content_index.py 2009-03-03 09:51:57 +0000
@@ -1,7 +1,7 @@
1# -*- encoding: utf-8 -*-1# -*- encoding: utf-8 -*-
2##############################################################################2##############################################################################
3#3#
4# OpenERP, Open Source Management Solution 4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6# $Id$6# $Id$
7#7#
@@ -29,27 +29,29 @@
29# This should be the indexer29# This should be the indexer
30#30#
31def content_index(content, filename=None, content_type=None):31def content_index(content, filename=None, content_type=None):
32 fname,ext = os.path.splitext(filename)32 fname,ext = os.path.splitext(filename)
33 result = ''33 result = ''
34 if ext in ('.doc'): #or content_type ?34 if ext in ('.doc'): #or content_type ?
35 (stdin,stdout) = os.popen2('antiword -', 'b')35 (stdin,stdout) = os.popen2('antiword -', 'b')
36 stdin.write(content)36 stdin.write(content)
37 stdin.close()37 stdin.close()
38 result = stdout.read().decode('latin1','replace').encode('utf-8','replace')38 result = stdout.read().decode('latin1','replace').encode('utf-8','replace')
39 elif ext == '.pdf':39 elif ext == '.pdf':
40 file_descriptor, file_name = tempfile.mkstemp(suffix=ext)40 file_descriptor, file_name = tempfile.mkstemp(suffix=ext)
41 os.write(file_descriptor, content)41 os.write(file_descriptor, content)
42 os.close(file_descriptor)42 os.close(file_descriptor)
43 fp = os.popen('pdftotext -enc UTF-8 -nopgbrk '+file_name+' -', 'r')43 fp = os.popen('pdftotext -enc UTF-8 -nopgbrk '+file_name+' -', 'r')
44 result = fp.read()44 result = fp.read()
45 fp.close()45 fp.close()
46 elif ext in ('.xls','.ods','.odt','.odp'):46 elif ext in ('.xls','.ods','.odt','.odp'):
47 s = StringIO.StringIO(content)47 s = StringIO.StringIO(content)
48 o = odt2txt.OpenDocumentTextFile(s)48 o = odt2txt.OpenDocumentTextFile(s)
49 result = o.toString().encode('ascii','replace')49 result = o.toString().encode('ascii','replace')
50 s.close()50 s.close()
51 elif ext in ('.txt','.py','.patch','.html','.csv','.xml'):51 elif ext in ('.txt','.py','.patch','.html','.csv','.xml'):
52 result = content52 result = content
53 else:53 else:
54 result = content54 result = content
55 return result55 return result
56
57# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
5658
=== modified file 'document/document.py'
--- document/document.py 2009-02-05 17:30:32 +0000
+++ document/document.py 2009-03-03 09:51:57 +0000
@@ -41,7 +41,7 @@
4141
42def random_name():42def random_name():
43 random.seed()43 random.seed()
44 d = [random.choice(string.letters) for x in xrange(10) ]44 d = [random.choice(string.ascii_letters) for x in xrange(10) ]
45 name = "".join(d)45 name = "".join(d)
46 return name46 return name
4747
@@ -492,11 +492,11 @@
492 result = {}492 result = {}
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))+')')
494 for id,r,l in cr.fetchall():494 for id,r,l in cr.fetchall():
495 try:495 try:
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()
497 result[id] = base64.encodestring(value)497 result[id] = base64.encodestring(value)
498 except:498 except:
499 result[id]=''499 result[id]=''
500500
501 if context.get('bin_size', False):501 if context.get('bin_size', False):
502 result[id] = tools.human_size(len(result[id]))502 result[id] = tools.human_size(len(result[id]))
@@ -581,7 +581,7 @@
581 res_id=file.res_id and file.res_id or 0581 res_id=file.res_id and file.res_id or 0
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)])
583 if len(res):583 if len(res):
584 return False584 return False
585 if op=='create':585 if op=='create':
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)])
587 if len(res):587 if len(res):
@@ -771,3 +771,5 @@
771 'target':'new',771 'target':'new',
772 }772 }
773document_configuration_wizard()773document_configuration_wizard()
774
775# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
774776
=== modified file 'document/ftpserver/__init__.py'
--- document/ftpserver/__init__.py 2008-12-18 08:55:57 +0000
+++ document/ftpserver/__init__.py 2009-03-03 09:51:57 +0000
@@ -1,3 +1,25 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6# $Id$
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
1import threading23import threading
2import ftpserver24import ftpserver
3import authorizer25import authorizer
@@ -31,3 +53,4 @@
31ds = ftp_server()53ds = ftp_server()
32ds.start()54ds.start()
3355
56# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3457
=== modified file 'document/ftpserver/abstracted_fs.py'
--- document/ftpserver/abstracted_fs.py 2009-01-02 06:00:20 +0000
+++ document/ftpserver/abstracted_fs.py 2009-03-03 09:51:57 +0000
@@ -1,3 +1,25 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6# $Id$
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
1import os23import os
2import time24import time
3from tarfile import filemode25from tarfile import filemode
@@ -788,3 +810,4 @@
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,
789 mode, uid, gid, unique, basename)811 mode, uid, gid, unique, basename)
790812
813# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
791814
=== modified file 'document/ftpserver/authorizer.py'
--- document/ftpserver/authorizer.py 2008-10-29 21:45:02 +0000
+++ document/ftpserver/authorizer.py 2009-03-03 09:51:57 +0000
@@ -1,3 +1,25 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6# $Id$
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
1#import pooler23#import pooler
224
3class authorizer:25class authorizer:
@@ -68,4 +90,4 @@
68 """Return the user's quitting message."""90 """Return the user's quitting message."""
69 return 'Bye.'91 return 'Bye.'
7092
7193# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
7294
=== modified file 'document/ftpserver/ftpserver.py'
--- document/ftpserver/ftpserver.py 2008-12-18 08:55:57 +0000
+++ document/ftpserver/ftpserver.py 2009-03-03 09:51:57 +0000
@@ -1,4 +1,5 @@
1#!/usr/bin/env python1#!/usr/bin/env python
2# -*- encoding: utf-8 -*-
2# ftpserver.py3# ftpserver.py
3#4#
4# pyftpdlib is released under the MIT license, reproduced below:5# pyftpdlib is released under the MIT license, reproduced below:
@@ -3094,3 +3095,5 @@
30943095
3095if __name__ == '__main__':3096if __name__ == '__main__':
3096 test()3097 test()
3098
3099# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
30973100
=== modified file 'document/odt2txt.py'
--- document/odt2txt.py 2009-01-04 22:12:50 +0000
+++ document/odt2txt.py 2009-03-03 09:51:57 +0000
@@ -2,7 +2,7 @@
2# -*- encoding: utf-8 -*-2# -*- encoding: utf-8 -*-
3##############################################################################3##############################################################################
4#4#
5# OpenERP, Open Source Management Solution 5# OpenERP, Open Source Management Solution
6# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved6# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
7# $Id$7# $Id$
8#8#
@@ -25,28 +25,30 @@
25import StringIO25import StringIO
2626
27class OpenDocumentTextFile :27class OpenDocumentTextFile :
28 def __init__ (self, filepath) :28 def __init__ (self, filepath) :
29 zip = zipfile.ZipFile(filepath)29 zip = zipfile.ZipFile(filepath)
30 self.content = xml.dom.minidom.parseString(zip.read("content.xml"))30 self.content = xml.dom.minidom.parseString(zip.read("content.xml"))
3131
32 def toString (self) :32 def toString (self) :
33 """ Converts the document to a string. """33 """ Converts the document to a string. """
34 buffer = u""34 buffer = u""
35 for val in ["text:p", "text:h", "text:list"]:35 for val in ["text:p", "text:h", "text:list"]:
36 for paragraph in self.content.getElementsByTagName(val) :36 for paragraph in self.content.getElementsByTagName(val) :
37 buffer += self.textToString(paragraph) + "\n"37 buffer += self.textToString(paragraph) + "\n"
38 return buffer38 return buffer
3939
40 def textToString(self, element) :40 def textToString(self, element) :
41 buffer = u""41 buffer = u""
42 for node in element.childNodes :42 for node in element.childNodes :
43 if node.nodeType == xml.dom.Node.TEXT_NODE :43 if node.nodeType == xml.dom.Node.TEXT_NODE :
44 buffer += node.nodeValue44 buffer += node.nodeValue
45 elif node.nodeType == xml.dom.Node.ELEMENT_NODE :45 elif node.nodeType == xml.dom.Node.ELEMENT_NODE :
46 buffer += self.textToString(node)46 buffer += self.textToString(node)
47 return buffer47 return buffer
4848
49if __name__ == "__main__" :49if __name__ == "__main__" :
50 s =StringIO.StringIO(file(sys.argv[1]).read())50 s =StringIO.StringIO(file(sys.argv[1]).read())
51 odt = OpenDocumentTextFile(s)51 odt = OpenDocumentTextFile(s)
52 print odt.toString().encode('ascii','replace')52 print odt.toString().encode('ascii','replace')
53
54# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
5355
=== modified file 'document_ics/__init__.py'
--- document_ics/__init__.py 2009-01-04 22:12:50 +0000
+++ document_ics/__init__.py 2009-03-03 09:51:57 +0000
@@ -21,3 +21,5 @@
21##############################################################################21##############################################################################
2222
23import document23import document
24
25# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: