summaryrefslogtreecommitdiff
path: root/addons/document/document.py
diff options
context:
space:
mode:
authorChristophe Chauvet <christophe.chauvet@syleam.fr>2009-03-03 10:51:57 +0100
committerChristophe Chauvet <christophe.chauvet@syleam.fr>2009-03-03 10:51:57 +0100
commit8f1d6918d24dd139e0d4340c6739a41b6ff6348a (patch)
treea81700b08377509f70b55e9cdc679ea9b1ed4006 /addons/document/document.py
parent8bcdd313adf2c88763316ebc9d9766a68de8e7d4 (diff)
[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: christophe.chauvet@syleam.fr-20090303095157-qdtic4sqftars0hv
Diffstat (limited to 'addons/document/document.py')
-rw-r--r--addons/document/document.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/addons/document/document.py b/addons/document/document.py
index 36d71c27a82..31ab13ae4df 100644
--- a/addons/document/document.py
+++ b/addons/document/document.py
@@ -41,7 +41,7 @@ import tools
def random_name():
random.seed()
- d = [random.choice(string.letters) for x in xrange(10) ]
+ d = [random.choice(string.ascii_letters) for x in xrange(10) ]
name = "".join(d)
return name
@@ -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: