Skip to content

Commit 324d48d

Browse files
committed
Switched to Python 3-compatible octal notation.
1 parent 85cd458 commit 324d48d

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

django/utils/daemonize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
if os.name == 'posix':
55
def become_daemon(our_home_dir='.', out_log='/dev/null',
6-
err_log='/dev/null', umask=022):
6+
err_log='/dev/null', umask=0o022):
77
"Robustly turn into a UNIX daemon, running in our_home_dir."
88
# First fork
99
try:

tests/regressiontests/conditional_processing/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,14 @@ class HttpDateProcessing(unittest.TestCase):
143143
def testParsingRfc1123(self):
144144
parsed = parse_http_date('Sun, 06 Nov 1994 08:49:37 GMT')
145145
self.assertEqual(datetime.utcfromtimestamp(parsed),
146-
datetime(1994, 11, 06, 8, 49, 37))
146+
datetime(1994, 11, 6, 8, 49, 37))
147147

148148
def testParsingRfc850(self):
149149
parsed = parse_http_date('Sunday, 06-Nov-94 08:49:37 GMT')
150150
self.assertEqual(datetime.utcfromtimestamp(parsed),
151-
datetime(1994, 11, 06, 8, 49, 37))
151+
datetime(1994, 11, 6, 8, 49, 37))
152152

153153
def testParsingAsctime(self):
154154
parsed = parse_http_date('Sun Nov 6 08:49:37 1994')
155155
self.assertEqual(datetime.utcfromtimestamp(parsed),
156-
datetime(1994, 11, 06, 8, 49, 37))
156+
datetime(1994, 11, 6, 8, 49, 37))

tests/regressiontests/file_storage/tests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ def test_race_condition(self):
424424
class FileStoragePermissions(unittest.TestCase):
425425
def setUp(self):
426426
self.old_perms = settings.FILE_UPLOAD_PERMISSIONS
427-
settings.FILE_UPLOAD_PERMISSIONS = 0666
427+
settings.FILE_UPLOAD_PERMISSIONS = 0o666
428428
self.storage_dir = tempfile.mkdtemp()
429429
self.storage = FileSystemStorage(self.storage_dir)
430430

@@ -434,8 +434,8 @@ def tearDown(self):
434434

435435
def test_file_upload_permissions(self):
436436
name = self.storage.save("the_file", ContentFile(b"data"))
437-
actual_mode = os.stat(self.storage.path(name))[0] & 0777
438-
self.assertEqual(actual_mode, 0666)
437+
actual_mode = os.stat(self.storage.path(name))[0] & 0o777
438+
self.assertEqual(actual_mode, 0o666)
439439

440440

441441
class FileStoragePathParsing(unittest.TestCase):

tests/regressiontests/file_uploads/tests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,16 +362,16 @@ def setUp(self):
362362
if not os.path.isdir(temp_storage.location):
363363
os.makedirs(temp_storage.location)
364364
if os.path.isdir(UPLOAD_TO):
365-
os.chmod(UPLOAD_TO, 0700)
365+
os.chmod(UPLOAD_TO, 0o700)
366366
shutil.rmtree(UPLOAD_TO)
367367

368368
def tearDown(self):
369-
os.chmod(temp_storage.location, 0700)
369+
os.chmod(temp_storage.location, 0o700)
370370
shutil.rmtree(temp_storage.location)
371371

372372
def test_readonly_root(self):
373373
"""Permission errors are not swallowed"""
374-
os.chmod(temp_storage.location, 0500)
374+
os.chmod(temp_storage.location, 0o500)
375375
try:
376376
self.obj.testfile.save('foo.txt', SimpleUploadedFile('foo.txt', b'x'))
377377
except OSError as err:

0 commit comments

Comments
 (0)