# HG changeset patch # User Samuel Trégouët # Date 1441979429 -7200 # Node ID 8e46ed1a0b8ad3d9f09138da06f762eaa69d2328 # Parent 7629902e7554dbd99833580a65dd9a133ba497ac [py3k] octals and long diff -r 7629902e7554 -r 8e46ed1a0b8a cwconfig.py --- a/cwconfig.py Fri Sep 11 15:29:25 2015 +0200 +++ b/cwconfig.py Fri Sep 11 15:50:29 2015 +0200 @@ -351,7 +351,7 @@ }), ('umask', {'type' : 'int', - 'default': 077, + 'default': 0o077, 'help': 'permission umask for files created by the server', 'group': 'main', 'level': 2, }), diff -r 7629902e7554 -r 8e46ed1a0b8a dataimport/test/test_pgstore.py --- a/dataimport/test/test_pgstore.py Fri Sep 11 15:29:25 2015 +0200 +++ b/dataimport/test/test_pgstore.py Fri Sep 11 15:50:29 2015 +0200 @@ -20,6 +20,7 @@ import datetime as DT +from six import PY2 from logilab.common.testlib import TestCase, unittest_main from cubicweb.dataimport import pgstore @@ -36,7 +37,8 @@ def test_convert_number(self): cnvt = pgstore._copyfrom_buffer_convert_number self.assertEqual('42', cnvt(42)) - self.assertEqual('42', cnvt(42L)) + if PY2: + self.assertEqual('42', cnvt(long(42))) self.assertEqual('42.42', cnvt(42.42)) def test_convert_string(self): @@ -64,9 +66,10 @@ # test buffer def test_create_copyfrom_buffer_tuple(self): - data = ((42, 42L, 42.42, u'éléphant', DT.date(666, 1, 13), DT.time(6, 6, 6), + l = long if PY2 else int + data = ((42, l(42), 42.42, u'éléphant', DT.date(666, 1, 13), DT.time(6, 6, 6), DT.datetime(666, 6, 13, 6, 6, 6)), - (6, 6L, 6.6, u'babar', DT.date(2014, 1, 14), DT.time(4, 2, 1), + (6, l(6), 6.6, u'babar', DT.date(2014, 1, 14), DT.time(4, 2, 1), DT.datetime(2014, 1, 1, 0, 0, 0))) results = pgstore._create_copyfrom_buffer(data) # all columns diff -r 7629902e7554 -r 8e46ed1a0b8a server/migractions.py --- a/server/migractions.py Fri Sep 11 15:29:25 2015 +0200 +++ b/server/migractions.py Fri Sep 11 15:50:29 2015 +0200 @@ -207,7 +207,7 @@ print('-> no backup done.') return open(backupfile,'w').close() # kinda lock - os.chmod(backupfile, 0600) + os.chmod(backupfile, 0o600) # backup source = repo.system_source tmpdir = tempfile.mkdtemp() diff -r 7629902e7554 -r 8e46ed1a0b8a server/sources/storages.py --- a/server/sources/storages.py Fri Sep 11 15:29:25 2015 +0200 +++ b/server/sources/storages.py Fri Sep 11 15:50:29 2015 +0200 @@ -105,7 +105,7 @@ class BytesFileSystemStorage(Storage): """store Bytes attribute value on the file system""" - def __init__(self, defaultdir, fsencoding='utf-8', wmode=0444): + def __init__(self, defaultdir, fsencoding='utf-8', wmode=0o444): if type(defaultdir) is unicode: defaultdir = defaultdir.encode(fsencoding) self.default_directory = defaultdir diff -r 7629902e7554 -r 8e46ed1a0b8a server/test/unittest_querier.py --- a/server/test/unittest_querier.py Fri Sep 11 15:29:25 2015 +0200 +++ b/server/test/unittest_querier.py Fri Sep 11 15:50:29 2015 +0200 @@ -21,6 +21,7 @@ from datetime import date, datetime, timedelta, tzinfo +from six import PY2 from logilab.common.testlib import TestCase, unittest_main from rql import BadRQLQuery, RQLSyntaxError @@ -263,8 +264,9 @@ self.assertEqual(rset.description[0][0], 'Datetime') rset = self.qexecute('Any %(x)s', {'x': 1}) self.assertEqual(rset.description[0][0], 'Int') - rset = self.qexecute('Any %(x)s', {'x': 1L}) - self.assertEqual(rset.description[0][0], 'Int') + if PY2: + rset = self.qexecute('Any %(x)s', {'x': long(1)}) + self.assertEqual(rset.description[0][0], 'Int') rset = self.qexecute('Any %(x)s', {'x': True}) self.assertEqual(rset.description[0][0], 'Boolean') rset = self.qexecute('Any %(x)s', {'x': 1.0}) diff -r 7629902e7554 -r 8e46ed1a0b8a sobjects/test/unittest_cwxmlparser.py --- a/sobjects/test/unittest_cwxmlparser.py Fri Sep 11 15:29:25 2015 +0200 +++ b/sobjects/test/unittest_cwxmlparser.py Fri Sep 11 15:50:29 2015 +0200 @@ -214,8 +214,8 @@ with self.admin_access.web_request() as req: user = req.execute('CWUser X WHERE X login "sthenault"').get_entity(0, 0) - self.assertEqual(user.creation_date, datetime(2010, 01, 22, 10, 27, 59)) - self.assertEqual(user.modification_date, datetime(2011, 01, 25, 14, 14, 06)) + self.assertEqual(user.creation_date, datetime(2010, 1, 22, 10, 27, 59)) + self.assertEqual(user.modification_date, datetime(2011, 1, 25, 14, 14, 6)) self.assertEqual(user.cwuri, 'http://pouet.org/5') self.assertEqual(user.cw_source[0].name, 'myfeed') self.assertEqual(user.absolute_url(), 'http://pouet.org/5') @@ -299,8 +299,8 @@ with self.repo.internal_cnx() as cnx: stats = dfsource.pull_data(cnx, force=True, raise_on_error=True) user = cnx.execute('CWUser X WHERE X login "sthenault"').get_entity(0, 0) - self.assertEqual(user.creation_date, datetime(2010, 01, 22, 10, 27, 59)) - self.assertEqual(user.modification_date, datetime(2011, 01, 25, 14, 14, 06)) + self.assertEqual(user.creation_date, datetime(2010, 1, 22, 10, 27, 59)) + self.assertEqual(user.modification_date, datetime(2011, 1, 25, 14, 14, 6)) self.assertEqual(user.cwuri, 'http://pouet.org/5') self.assertEqual(user.cw_source[0].name, 'myfeed') diff -r 7629902e7554 -r 8e46ed1a0b8a toolsutils.py --- a/toolsutils.py Fri Sep 11 15:29:25 2015 +0200 +++ b/toolsutils.py Fri Sep 11 15:50:29 2015 +0200 @@ -162,7 +162,7 @@ log('set permissions to 0600 for %s', filepath) else: print('-> set permissions to 0600 for %s' % filepath) - chmod(filepath, 0600) + chmod(filepath, 0o600) def read_config(config_file, raise_if_unreadable=False): """read some simple configuration from `config_file` and return it as a