Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
e9531ee8
Commit
e9531ee8
authored
Sep 23, 2022
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py2/py3: file() -> open().
parent
7e63228e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
13 deletions
+13
-13
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
...eItem/portal_components/test.erp5.testBusinessTemplate.py
+7
-7
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCRM.py
...m/TestTemplateItem/portal_components/test.erp5.testCRM.py
+1
-1
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.SyncMLTransportFile.py
...Item/portal_components/module.erp5.SyncMLTransportFile.py
+1
-1
bt5/erp5_syncml/ToolComponentTemplateItem/portal_components/tool.erp5.SynchronizationTool.py
...teItem/portal_components/tool.erp5.SynchronizationTool.py
+1
-1
product/ERP5/tests/extractMessageCatalog.py
product/ERP5/tests/extractMessageCatalog.py
+1
-1
product/ERP5/tests/utils.py
product/ERP5/tests/utils.py
+1
-1
product/ERP5Type/patches/DA.py
product/ERP5Type/patches/DA.py
+1
-1
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
View file @
e9531ee8
...
...
@@ -224,7 +224,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
file_path
=
os
.
path
.
join
(
cfg
.
instancehome
,
'tests'
,
test_title
+
'.py'
)
if
os
.
path
.
exists
(
file_path
):
os
.
remove
(
file_path
)
f
=
file
(
file_path
,
'w'
)
f
=
open
(
file_path
,
'w'
)
f
.
write
(
test_data
)
f
.
close
()
self
.
assertTrue
(
os
.
path
.
exists
(
file_path
))
...
...
@@ -2371,7 +2371,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
file_path
=
os
.
path
.
join
(
cfg
.
instancehome
,
'PropertySheet'
,
ps_title
+
'.py'
)
if
os
.
path
.
exists
(
file_path
):
os
.
remove
(
file_path
)
f
=
file
(
file_path
,
'w'
)
f
=
open
(
file_path
,
'w'
)
f
.
write
(
ps_data
)
f
.
close
()
self
.
assertTrue
(
os
.
path
.
exists
(
file_path
))
...
...
@@ -2463,7 +2463,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
file_path
=
os
.
path
.
join
(
cfg
.
instancehome
,
'PropertySheet'
,
ps_title
+
'.py'
)
if
os
.
path
.
exists
(
file_path
):
os
.
remove
(
file_path
)
f
=
file
(
file_path
,
'w'
)
f
=
open
(
file_path
,
'w'
)
f
.
write
(
ps_data
)
f
.
close
()
self
.
assertTrue
(
os
.
path
.
exists
(
file_path
))
...
...
@@ -8036,7 +8036,7 @@ class _LocalTemplateItemMixin:
file_path
=
os
.
path
.
join
(
self
.
document_base_path
,
self
.
document_title
+
'.py'
)
if
os
.
path
.
exists
(
file_path
):
os
.
remove
(
file_path
)
f
=
file
(
file_path
,
'w'
)
f
=
open
(
file_path
,
'w'
)
f
.
write
(
self
.
document_data
)
f
.
close
()
self
.
assertTrue
(
os
.
path
.
exists
(
file_path
))
...
...
@@ -8048,7 +8048,7 @@ class _LocalTemplateItemMixin:
file_path
=
os
.
path
.
join
(
self
.
document_base_path
,
self
.
document_title
+
'.py'
)
if
os
.
path
.
exists
(
file_path
):
os
.
remove
(
file_path
)
f
=
file
(
file_path
,
'w'
)
f
=
open
(
file_path
,
'w'
)
f
.
write
(
self
.
document_data_updated
)
f
.
close
()
self
.
assertTrue
(
os
.
path
.
exists
(
file_path
))
...
...
@@ -8070,12 +8070,12 @@ class _LocalTemplateItemMixin:
def
stepCheckDocumentExists
(
self
,
sequence
=
None
,
**
kw
):
self
.
assertFalse
(
not
os
.
path
.
exists
(
sequence
[
'document_path'
]))
self
.
assertEqual
(
file
(
sequence
[
'document_path'
]).
read
(),
self
.
assertEqual
(
open
(
sequence
[
'document_path'
]).
read
(),
sequence
[
'document_data'
])
def
stepCheckUpdatedDocumentExists
(
self
,
sequence
=
None
,
**
kw
):
self
.
assertFalse
(
not
os
.
path
.
exists
(
sequence
[
'document_path'
]))
self
.
assertEqual
(
file
(
sequence
[
'document_path'
]).
read
(),
self
.
assertEqual
(
open
(
sequence
[
'document_path'
]).
read
(),
sequence
[
'document_data_updated'
])
def
stepCheckDocumentRemoved
(
self
,
sequence
=
None
,
**
kw
):
...
...
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCRM.py
View file @
e9531ee8
...
...
@@ -693,7 +693,7 @@ class TestCRMMailIngestion(BaseTestCRM):
def
_readTestData
(
self
,
filename
):
"""read test data from data directory."""
return
file
(
makeFilePath
(
filename
)).
read
()
return
open
(
makeFilePath
(
filename
)).
read
()
def
_ingestMail
(
self
,
filename
=
None
,
data
=
None
):
"""ingest an email from the mail in data dir named `filename`"""
...
...
bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.SyncMLTransportFile.py
View file @
e9531ee8
...
...
@@ -32,7 +32,7 @@ class FileTransport:
def
send
(
self
,
to_url
,
data
,
sync_id
,
content_type
):
filename
=
to_url
[
len
(
'file:/'
):]
try
:
stream
=
file
(
filename
,
'w'
)
stream
=
open
(
filename
,
'w'
)
stream
.
write
(
data
)
stream
.
close
()
except
IOError
:
...
...
bt5/erp5_syncml/ToolComponentTemplateItem/portal_components/tool.erp5.SynchronizationTool.py
View file @
e9531ee8
...
...
@@ -262,7 +262,7 @@ class SynchronizationTool(BaseTool):
filename
=
from_url
[
len
(
'file:'
):]
xml
=
None
try
:
stream
=
file
(
filename
,
'r'
)
stream
=
open
(
filename
,
'r'
)
except
IOError
:
# XXX-Aurel : Why raising here make unit tests to fail ?
# raise ValueError("Impossible to read file %s, error is %s"
...
...
product/ERP5/tests/extractMessageCatalog.py
View file @
e9531ee8
...
...
@@ -63,7 +63,7 @@ class ExtractMessageCatalog(TestXHTML):
messages
=
dict
(
getattr
(
self
.
portal
.
Localizer
,
i
).
_messages
)
result
[
i
].
update
(
messages
)
f
=
file
(
'%s.pot'
%
i
,
'w'
)
f
=
open
(
'%s.pot'
%
i
,
'w'
)
for
msgid
in
result
[
i
].
keys
():
f
.
write
(
'msgid "%s"
\
n
msgstr ""
\
n
\
n
'
%
msgid
)
...
...
product/ERP5/tests/utils.py
View file @
e9531ee8
...
...
@@ -186,4 +186,4 @@ class BusinessTemplateInfoDir(BusinessTemplateInfoBase):
return
fileinfo
def
readFileInfo
(
self
,
fileinfo
):
return
file
(
fileinfo
).
read
()
return
open
(
fileinfo
).
read
()
product/ERP5Type/patches/DA.py
View file @
e9531ee8
...
...
@@ -36,7 +36,7 @@ def DA_fromFile(self, filename):
"""
Read the file and update self
"""
f
=
file
(
filename
)
f
=
open
(
filename
)
s
=
f
.
read
()
f
.
close
()
self
.
fromText
(
s
)
...
...
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