Changed the path where csv files are stored. Now takes the 'data_path' variable of the trytond config file.

This commit is contained in:
jmartin 2013-09-20 09:10:41 +02:00
parent 7ce4c23a2b
commit 34f8c09a5e

View file

@ -171,9 +171,13 @@ class CSVArchive(Workflow, ModelSQL, ModelView):
@classmethod
def set_data(cls, archives, name, value):
path = os.path.abspath(os.path.dirname(__file__))
cursor = Transaction().cursor
path = os.path.join(CONFIG.get('data_path', '/var/lib/trytond'),
cursor.database_name, 'csv_import')
if not os.path.exists(path):
os.makedirs(path, mode=0777)
for archive in archives:
archive = '%s/csv/%s' % (path, archive.archive_name)
archive = '%s/%s' % (path, archive.archive_name)
try:
with open(archive, 'w') as f:
f.write(value)