Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubicweb
Commits
8e46ed1a0b8a
Commit
fa06a546
authored
Sep 11, 2015
by
Samuel Trégouët
Browse files
[py3k] octals and long
parent
7629902e7554
Changes
7
Hide whitespace changes
Inline
Side-by-side
cwconfig.py
View file @
8e46ed1a
...
...
@@ -351,7 +351,7 @@ class CubicWebNoAppConfiguration(ConfigurationMixIn):
}),
(
'umask'
,
{
'type'
:
'int'
,
'default'
:
077
,
'default'
:
0o
077
,
'help'
:
'permission umask for files created by the server'
,
'group'
:
'main'
,
'level'
:
2
,
}),
...
...
dataimport/test/test_pgstore.py
View file @
8e46ed1a
...
...
@@ -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 @@ class CreateCopyFromBufferTC(TestCase):
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 @@ class CreateCopyFromBufferTC(TestCase):
# 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
...
...
server/migractions.py
View file @
8e46ed1a
...
...
@@ -207,7 +207,7 @@ class ServerMigrationHelper(MigrationHelper):
print
(
'-> no backup done.'
)
return
open
(
backupfile
,
'w'
).
close
()
# kinda lock
os
.
chmod
(
backupfile
,
0600
)
os
.
chmod
(
backupfile
,
0
o
600
)
# backup
source
=
repo
.
system_source
tmpdir
=
tempfile
.
mkdtemp
()
...
...
server/sources/storages.py
View file @
8e46ed1a
...
...
@@ -105,7 +105,7 @@ def fsimport(cnx):
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
=
0
o
444
):
if
type
(
defaultdir
)
is
unicode
:
defaultdir
=
defaultdir
.
encode
(
fsencoding
)
self
.
default_directory
=
defaultdir
...
...
server/test/unittest_querier.py
View file @
8e46ed1a
...
...
@@ -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 @@ class UtilsTC(BaseQuerierTC):
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
})
...
...
sobjects/test/unittest_cwxmlparser.py
View file @
8e46ed1a
...
...
@@ -214,8 +214,8 @@ class CWEntityXMLParserTC(CubicWebTC):
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
,
0
1
,
22
,
10
,
27
,
59
))
self
.
assertEqual
(
user
.
modification_date
,
datetime
(
2011
,
0
1
,
25
,
14
,
14
,
0
6
))
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 @@ class CWEntityXMLParserTC(CubicWebTC):
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
,
0
1
,
22
,
10
,
27
,
59
))
self
.
assertEqual
(
user
.
modification_date
,
datetime
(
2011
,
0
1
,
25
,
14
,
14
,
0
6
))
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'
)
...
...
toolsutils.py
View file @
8e46ed1a
...
...
@@ -162,7 +162,7 @@ def restrict_perms_to_user(filepath, log=None):
log
(
'set permissions to 0600 for %s'
,
filepath
)
else
:
print
(
'-> set permissions to 0600 for %s'
%
filepath
)
chmod
(
filepath
,
0600
)
chmod
(
filepath
,
0
o
600
)
def
read_config
(
config_file
,
raise_if_unreadable
=
False
):
"""read some simple configuration from `config_file` and return it as a
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment