# HG changeset patch # User Nicolas Chauvat # Date 1248353500 -7200 # Node ID 440cb4ea7e5c6100e4f6c9328a48344c5bb75a50 # Parent 6f065b366d14483545454bcddd3ec631ce1640d4 [refactor] #342855: replace uses of (deprecated) mktemp diff -r 6f065b366d14 -r 440cb4ea7e5c common/migration.py --- a/common/migration.py Thu Jul 23 14:45:31 2009 +0200 +++ b/common/migration.py Thu Jul 23 14:51:40 2009 +0200 @@ -11,7 +11,7 @@ import sys import os import logging -from tempfile import mktemp +import tempfile from os.path import exists, join, basename, splitext from logilab.common.decorators import cached @@ -337,7 +337,7 @@ configfile = self.config.main_config_file() if self._option_changes: read_old_config(self.config, self._option_changes, configfile) - newconfig = mktemp() + newconfig = mkstemp() for optdescr in self._option_changes: if optdescr[0] == 'added': optdict = self.config.get_option_def(optdescr[1]) diff -r 6f065b366d14 -r 440cb4ea7e5c devtools/devctl.py --- a/devtools/devctl.py Thu Jul 23 14:45:31 2009 +0200 +++ b/devtools/devctl.py Thu Jul 23 14:51:40 2009 +0200 @@ -254,13 +254,12 @@ if args: raise BadCommandUsage('Too much arguments') import shutil - from tempfile import mktemp + import tempfile import yams from logilab.common.fileutils import ensure_fs_mode from logilab.common.shellutils import globfind, find, rm from cubicweb.common.i18n import extract_from_tal, execute - tempdir = mktemp() - mkdir(tempdir) + tempdir = tempdir.mkdtemp() potfiles = [join(I18NDIR, 'entities.pot')] print '******** extract schema messages' schemapot = join(tempdir, 'schema.pot') @@ -348,14 +347,13 @@ def update_cube_catalogs(cubedir): import shutil - from tempfile import mktemp + import tempfile from logilab.common.fileutils import ensure_fs_mode from logilab.common.shellutils import find, rm from cubicweb.common.i18n import extract_from_tal, execute toedit = [] cube = basename(normpath(cubedir)) - tempdir = mktemp() - mkdir(tempdir) + tempdir = tempfile.mkdtemp() print '*' * 72 print 'updating %s cube...' % cube chdir(cubedir) diff -r 6f065b366d14 -r 440cb4ea7e5c server/serverctl.py --- a/server/serverctl.py Thu Jul 23 14:45:31 2009 +0200 +++ b/server/serverctl.py Thu Jul 23 14:51:40 2009 +0200 @@ -649,7 +649,7 @@ import tempfile srcappid = pop_arg(args, 1, msg="No source application specified !") destappid = pop_arg(args, msg="No destination application specified !") - output = tempfile.mktemp() + output = tempfile.mkstemp() if ':' in srcappid: host, srcappid = srcappid.split(':') _remote_dump(host, srcappid, output, self.config.sudo) diff -r 6f065b366d14 -r 440cb4ea7e5c test/unittest_cwconfig.py --- a/test/unittest_cwconfig.py Thu Jul 23 14:45:31 2009 +0200 +++ b/test/unittest_cwconfig.py Thu Jul 23 14:51:40 2009 +0200 @@ -8,7 +8,6 @@ import sys import os from os.path import dirname, join, abspath -from tempfile import mktemp from logilab.common.testlib import TestCase, unittest_main from logilab.common.changelog import Version diff -r 6f065b366d14 -r 440cb4ea7e5c web/views/__init__.py --- a/web/views/__init__.py Thu Jul 23 14:45:31 2009 +0200 +++ b/web/views/__init__.py Thu Jul 23 14:51:40 2009 +0200 @@ -8,7 +8,7 @@ __docformat__ = "restructuredtext en" import os -from tempfile import mktemp +import tempfile from rql import nodes @@ -109,7 +109,7 @@ def cell_call(self, row=0, col=0): self.row, self.col = row, col # in case one need it - tmpfile = mktemp('.png') + tmpfile = tempfile.mkstemp('.png') try: self._generate(tmpfile) self.w(open(tmpfile).read())