Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixing temp file location calls
  • Loading branch information
audaciouscode committed Apr 27, 2017
1 parent 8ce1183 commit 647a43d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion decorators.py
@@ -1,5 +1,6 @@
import time
import logging
import tempfile

from lockfile import FileLock, AlreadyLocked, LockTimeout

Expand Down Expand Up @@ -39,7 +40,7 @@ def wrapper(self, *args, **options):
logging.debug("-" * 72)

lock_name = self.__module__.split('.').pop()
lock = FileLock('/tmp/pdk_lock_' + lock_name)
lock = FileLock(tempfile.gettempdir() + '/pdk_lock_' + lock_name)

logging.debug("%s - acquiring lock..." % lock_name)
try:
Expand Down
3 changes: 2 additions & 1 deletion management/commands/compile_reports.py
Expand Up @@ -4,6 +4,7 @@
import json
import os
import pytz
import tempdir
import traceback

import importlib
Expand Down Expand Up @@ -56,7 +57,7 @@ def handle(self, *args, **options):
if ('raw_data' in report.parameters) and report.parameters['raw_data'] is True:
raw_json = True

filename = '/tmp/pdk_export_' + str(report.pk) + '.zip'
filename = tempfile.gettempdir() + '/pdk_export_' + str(report.pk) + '.zip'

with ZipFile(filename, 'w') as export_file:
for generator in generators:
Expand Down
3 changes: 2 additions & 1 deletion pdk_api.py
Expand Up @@ -2,6 +2,7 @@
import codecs
import csv
import json
import tempdir

from django.template.loader import render_to_string

Expand Down Expand Up @@ -30,7 +31,7 @@
# return None

def compile_report(generator, sources):
filename = '/tmp/pdk_' + generator + '.txt'
filename = tempfile.gettempdir() + '/pdk_' + generator + '.txt'

with open(filename, 'w') as outfile:
writer = csv.writer(outfile, delimiter='\t')
Expand Down

0 comments on commit 647a43d

Please sign in to comment.