diff options
| author | Stephane Wirtel <stephane@tinyerp.com> | 2009-03-19 13:50:15 +0100 |
|---|---|---|
| committer | Stephane Wirtel <stephane@tinyerp.com> | 2009-03-19 13:50:15 +0100 |
| commit | e2e8b1941ed49865646edec0f2908d3aa2516277 (patch) | |
| tree | b56842f73986a4d0873943403ab4d8fce5659dd1 /addons/document/document.py | |
| parent | 01c974e40da76c36f9f47102fcc5befab392cbb3 (diff) | |
| parent | 8f1d6918d24dd139e0d4340c6739a41b6ff6348a (diff) | |
[MERGE] Branch from Christophe Chauvat (Sylëam)
[IMP]
* Correct bug with locale, use string.ascii_letters instead of string.letters
* Remove mixing tabs with spaces (PEP8 compliant)
* Add UTF8 header in python file
* Add vim comment at the end of file
* Add license header that missing on many files
bzr revid: stephane@tinyerp.com-20090319125015-221hyuhyb9s0vfcq
Diffstat (limited to 'addons/document/document.py')
| -rw-r--r-- | addons/document/document.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/addons/document/document.py b/addons/document/document.py index e86d90e4643..31ab13ae4df 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -492,11 +492,11 @@ class document_file(osv.osv): result = {} cr.execute('select id,store_fname,link from ir_attachment where id in ('+','.join(map(str,ids))+')') for id,r,l in cr.fetchall(): - try: - value = file(os.path.join(self._get_filestore(cr), r), 'rb').read() - result[id] = base64.encodestring(value) - except: - result[id]='' + try: + value = file(os.path.join(self._get_filestore(cr), r), 'rb').read() + result[id] = base64.encodestring(value) + except: + result[id]='' if context.get('bin_size', False): result[id] = tools.human_size(len(result[id])) @@ -581,7 +581,7 @@ class document_file(osv.osv): res_id=file.res_id and file.res_id or 0 res=self.search(cr,uid,[('id','<>',file.id),('name','=',name),('parent_id','=',parent_id),('res_model','=',res_model),('res_id','=',res_id)]) if len(res): - return False + return False if op=='create': res=self.search(cr,uid,[('name','=',name),('parent_id','=',parent_id),('res_id','=',res_id),('res_model','=',res_model)]) if len(res): @@ -771,3 +771,5 @@ class document_configuration_wizard(osv.osv_memory): 'target':'new', } document_configuration_wizard() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
