From 7ad6923620c8bf08eed11b86b8f58464a3add5f7 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Thu, 13 Nov 2008 16:29:23 +0100 Subject: [PATCH] a filestore per database bzr revid: stephane@tinyerp.com-20081113152923-2jgrsq4na87sx0z4 --- addons/document/document.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/document/document.py b/addons/document/document.py index 31de70cc63f..498534379f7 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -471,7 +471,7 @@ def random_name(): def create_directory(path): dir_name = random_name() path = os.path.join(path,dir_name) - os.mkdir(path) + os.makedirs(path) return dir_name class document_file(osv.osv): @@ -484,7 +484,7 @@ class document_file(osv.osv): result[id] = d elif m=='fs': try: - path = os.path.join(os.getcwd(),'filestore') + path = os.path.join(os.getcwd(), cr.dbname,'filestore') value = file(os.path.join(path,r), 'rb').read() result[id] = base64.encodestring(value) except: @@ -500,9 +500,9 @@ class document_file(osv.osv): if not value: return True if (not context) or context.get('store_method','fs')=='fs': - path = os.path.join(os.getcwd(), "filestore") + path = os.path.join(os.getcwd(), cr.dbname, "filestore") if not os.path.isdir(path): - os.mkdir(path) + os.makedirs(path) flag = None # This can be improved for dirs in os.listdir(path): @@ -620,7 +620,7 @@ class document_file(osv.osv): for f in self.browse(cr, uid, ids, context): if f.store_method=='fs': try: - path = os.path.join(os.getcwd(),'filestore',f.store_fname) + path = os.path.join(os.getcwd(), cr.dbname, 'filestore',f.store_fname) os.unlink(path) except: pass