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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Gambier
erp5
Commits
a7d4459c
Commit
a7d4459c
authored
Sep 19, 2022
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! py2/py3: Make Products code compatible with both python2 and python3.
parent
489b50e3
Changes
25
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
61 additions
and
61 deletions
+61
-61
product/ERP5/tests/erp5_url_checker.py
product/ERP5/tests/erp5_url_checker.py
+5
-3
product/ERP5/tests/testXHTML.py
product/ERP5/tests/testXHTML.py
+2
-2
product/ERP5OOo/tests/testFormPrintoutAsODT.py
product/ERP5OOo/tests/testFormPrintoutAsODT.py
+2
-2
product/ERP5OOo/tests/testOOoDynamicStyle.py
product/ERP5OOo/tests/testOOoDynamicStyle.py
+1
-1
product/ERP5OOo/tests/testOOoImport.py
product/ERP5OOo/tests/testOOoImport.py
+7
-7
product/ERP5Type/patches/DCWorkflow.py
product/ERP5Type/patches/DCWorkflow.py
+9
-9
product/ERP5Type/patches/WorkflowTool.py
product/ERP5Type/patches/WorkflowTool.py
+1
-1
product/ERP5Type/patches/sqltest.py
product/ERP5Type/patches/sqltest.py
+2
-2
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
+1
-1
product/ERP5Type/tests/ERP5TypeTestCase.py
product/ERP5Type/tests/ERP5TypeTestCase.py
+2
-2
product/ERP5Type/tests/ERP5TypeTestSuite.py
product/ERP5Type/tests/ERP5TypeTestSuite.py
+3
-3
product/ERP5Type/tests/ProcessingNodeTestCase.py
product/ERP5Type/tests/ProcessingNodeTestCase.py
+1
-1
product/ERP5Type/tests/Python3StyleTest.py
product/ERP5Type/tests/Python3StyleTest.py
+1
-1
product/ERP5Type/tests/runUnitTest.py
product/ERP5Type/tests/runUnitTest.py
+1
-1
product/ERP5Type/tests/testDynamicClassGeneration.py
product/ERP5Type/tests/testDynamicClassGeneration.py
+1
-1
product/ERP5Type/tests/utils.py
product/ERP5Type/tests/utils.py
+1
-1
product/Formulator/tests/testFormValidator.py
product/Formulator/tests/testFormValidator.py
+2
-2
product/Formulator/tests/testSerializeForm.py
product/Formulator/tests/testSerializeForm.py
+5
-5
product/HBTreeFolder2/tests/testHBTreeFolder2.py
product/HBTreeFolder2/tests/testHBTreeFolder2.py
+3
-3
product/MailTemplates/tests/test_FSMailTemplate.py
product/MailTemplates/tests/test_FSMailTemplate.py
+1
-1
product/MailTemplates/tests/test_MailTemplate.py
product/MailTemplates/tests/test_MailTemplate.py
+3
-3
product/PortalTransforms/libtransforms/utils.py
product/PortalTransforms/libtransforms/utils.py
+2
-2
product/PortalTransforms/transforms/python.py
product/PortalTransforms/transforms/python.py
+3
-5
product/ZMySQLDA/tests/testDeferredConnection.py
product/ZMySQLDA/tests/testDeferredConnection.py
+1
-1
product/Zelenium/generator.py
product/Zelenium/generator.py
+1
-1
No files found.
product/ERP5/tests/erp5_url_checker.py
View file @
a7d4459c
...
@@ -121,7 +121,7 @@ class URLOpener(FancyURLopener):
...
@@ -121,7 +121,7 @@ class URLOpener(FancyURLopener):
if
data
is
not
None
:
if
data
is
not
None
:
h
.
send
(
data
+
'
\
r
\
n
'
)
h
.
send
(
data
+
'
\
r
\
n
'
)
errcode
,
errmsg
,
headers
=
h
.
getreply
()
errcode
,
errmsg
,
headers
=
h
.
getreply
()
if
headers
and
headers
.
has_key
(
'set-cookie'
)
:
if
headers
and
'set-cookie'
in
headers
:
cookies
=
headers
.
getallmatchingheaders
(
'set-cookie'
)
cookies
=
headers
.
getallmatchingheaders
(
'set-cookie'
)
for
cookie
in
cookies
:
self
.
cookies
.
load
(
cookie
)
for
cookie
in
cookies
:
self
.
cookies
.
load
(
cookie
)
...
@@ -147,13 +147,15 @@ class Checker(URLOpener):
...
@@ -147,13 +147,15 @@ class Checker(URLOpener):
while
thread
.
isAlive
():
while
thread
.
isAlive
():
sleep
(
0.5
)
sleep
(
0.5
)
print
"Connection to %s went fine"
%
url
print
"Connection to %s went fine"
%
url
except
IOError
,
(
errno
,
strerror
):
except
IOError
as
err
:
(
errno
,
strerror
)
=
err
.
args
print
"Can't connect to %s because of I/O error(%s): %s"
%
(
url
,
errno
,
strerror
)
print
"Can't connect to %s because of I/O error(%s): %s"
%
(
url
,
errno
,
strerror
)
def
SearchUrl
(
self
,
url
=
None
):
def
SearchUrl
(
self
,
url
=
None
):
try
:
try
:
conn
=
self
.
open_http
(
url
)
conn
=
self
.
open_http
(
url
)
except
IOError
,
(
errno
,
strerror
):
except
IOError
as
err
:
(
errno
,
strerror
)
=
err
.
args
print
"Can't connect to %s because of I/O error(%s): %s"
%
(
url
,
errno
,
strerror
)
print
"Can't connect to %s because of I/O error(%s): %s"
%
(
url
,
errno
,
strerror
)
...
...
product/ERP5/tests/testXHTML.py
View file @
a7d4459c
...
@@ -128,7 +128,7 @@ class TestXHTMLMixin(ERP5TypeTestCase):
...
@@ -128,7 +128,7 @@ class TestXHTMLMixin(ERP5TypeTestCase):
yield
field
yield
field
except
Exception
:
except
Exception
:
yield
field
yield
field
except
AttributeError
,
e
:
except
AttributeError
as
e
:
ZopeTestCase
.
_print
(
"%s is broken: %s"
%
(
form_path
,
e
))
ZopeTestCase
.
_print
(
"%s is broken: %s"
%
(
form_path
,
e
))
def
test_deadProxyFields
(
self
):
def
test_deadProxyFields
(
self
):
...
@@ -245,7 +245,7 @@ class TestXHTMLMixin(ERP5TypeTestCase):
...
@@ -245,7 +245,7 @@ class TestXHTMLMixin(ERP5TypeTestCase):
try
:
try
:
stdout
,
stderr
=
Popen
(
args
,
stdin
=
PIPE
,
stdout
=
PIPE
,
stderr
=
PIPE
,
stdout
,
stderr
=
Popen
(
args
,
stdin
=
PIPE
,
stdout
=
PIPE
,
stderr
=
PIPE
,
close_fds
=
True
).
communicate
(
body
)
close_fds
=
True
).
communicate
(
body
)
except
OSError
,
e
:
except
OSError
as
e
:
e
.
strerror
+=
'
\
n
%r'
%
os
.
environ
e
.
strerror
+=
'
\
n
%r'
%
os
.
environ
raise
raise
if
stdout
:
if
stdout
:
...
...
product/ERP5OOo/tests/testFormPrintoutAsODT.py
View file @
a7d4459c
...
@@ -484,7 +484,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
...
@@ -484,7 +484,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
last_row
=
odf_table_rows
[
-
1
]
last_row
=
odf_table_rows
[
-
1
]
last_row_columns
=
last_row
.
getchildren
()
last_row_columns
=
last_row
.
getchildren
()
span_attribute
=
"{%s}number-columns-spanned"
%
content
.
nsmap
[
'table'
]
span_attribute
=
"{%s}number-columns-spanned"
%
content
.
nsmap
[
'table'
]
self
.
assertFalse
(
first_row_columns
[
0
].
attrib
.
has_key
(
span_attribute
)
)
self
.
assertFalse
(
span_attribute
in
first_row_columns
[
0
].
attrib
)
self
.
assertEqual
(
int
(
last_row_columns
[
0
].
attrib
[
span_attribute
]),
2
)
self
.
assertEqual
(
int
(
last_row_columns
[
0
].
attrib
[
span_attribute
]),
2
)
self
.
_validate
(
odf_document
)
self
.
_validate
(
odf_document
)
...
@@ -637,7 +637,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
...
@@ -637,7 +637,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
first_row_columns
=
first_row
.
getchildren
()
first_row_columns
=
first_row
.
getchildren
()
date_column
=
first_row_columns
[
3
]
date_column
=
first_row_columns
[
3
]
date_value_attrib
=
"{%s}date-value"
%
content
.
nsmap
[
'office'
]
date_value_attrib
=
"{%s}date-value"
%
content
.
nsmap
[
'office'
]
self
.
assertTrue
(
date_
column
.
attrib
.
has_key
(
date_value_attrib
)
)
self
.
assertTrue
(
date_
value_attrib
in
date_column
.
attrib
)
self
.
assertEqual
(
date_column
.
attrib
[
date_value_attrib
],
'2009-04-20'
)
self
.
assertEqual
(
date_column
.
attrib
[
date_value_attrib
],
'2009-04-20'
)
self
.
_validate
(
odf_document
)
self
.
_validate
(
odf_document
)
...
...
product/ERP5OOo/tests/testOOoDynamicStyle.py
View file @
a7d4459c
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
import
os
import
os
import
unittest
import
unittest
from
cStringIO
import
StringIO
from
six.moves
import
cStringIO
as
StringIO
from
zipfile
import
ZipFile
from
zipfile
import
ZipFile
from
Products.ERP5Type.tests.utils
import
FileUpload
from
Products.ERP5Type.tests.utils
import
FileUpload
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
...
...
product/ERP5OOo/tests/testOOoImport.py
View file @
a7d4459c
...
@@ -65,17 +65,17 @@ class TestOOoImportMixin(ERP5TypeTestCase):
...
@@ -65,17 +65,17 @@ class TestOOoImportMixin(ERP5TypeTestCase):
gender_bc
=
self
.
gender_base_cat_id
gender_bc
=
self
.
gender_base_cat_id
if
gender_bc
not
in
portal_categories
.
objectIds
():
if
gender_bc
not
in
portal_categories
.
objectIds
():
portal_categories
.
newContent
(
portal_type
=
'Base Category'
,
id
=
gender_bc
)
portal_categories
.
newContent
(
portal_type
=
'Base Category'
,
id
=
gender_bc
)
if
not
portal_categories
[
gender_bc
].
has_key
(
'male'
)
:
if
'male'
not
in
portal_categories
[
gender_bc
]
:
portal_categories
[
gender_bc
].
newContent
(
id
=
'male'
,
portal_type
=
'Category'
,
title
=
'Male'
)
portal_categories
[
gender_bc
].
newContent
(
id
=
'male'
,
portal_type
=
'Category'
,
title
=
'Male'
)
if
not
portal_categories
[
gender_bc
].
has_key
(
'female'
)
:
if
'female'
not
in
portal_categories
[
gender_bc
]
:
portal_categories
[
gender_bc
].
newContent
(
id
=
'female'
,
portal_type
=
'Category'
,
title
=
'Female'
)
portal_categories
[
gender_bc
].
newContent
(
id
=
'female'
,
portal_type
=
'Category'
,
title
=
'Female'
)
function_bc
=
self
.
function_base_cat_id
function_bc
=
self
.
function_base_cat_id
if
function_bc
not
in
portal_categories
.
objectIds
():
if
function_bc
not
in
portal_categories
.
objectIds
():
portal_categories
.
newContent
(
portal_type
=
'Base Category'
,
id
=
function_bc
)
portal_categories
.
newContent
(
portal_type
=
'Base Category'
,
id
=
function_bc
)
if
not
portal_categories
[
function_bc
].
has_key
(
'director'
)
:
if
'director'
not
in
portal_categories
[
function_bc
]
:
portal_categories
[
function_bc
].
newContent
(
id
=
'director'
,
portal_type
=
'Category'
,
title
=
'Director'
)
portal_categories
[
function_bc
].
newContent
(
id
=
'director'
,
portal_type
=
'Category'
,
title
=
'Director'
)
if
not
portal_categories
[
function_bc
].
has_key
(
'manager'
)
:
if
'manager'
not
in
portal_categories
[
function_bc
]
:
portal_categories
[
function_bc
].
newContent
(
id
=
'manager'
,
portal_type
=
'Category'
,
title
=
'Manager'
)
portal_categories
[
function_bc
].
newContent
(
id
=
'manager'
,
portal_type
=
'Category'
,
title
=
'Manager'
)
self
.
portal
.
portal_caches
.
clearCache
()
self
.
portal
.
portal_caches
.
clearCache
()
...
@@ -821,7 +821,7 @@ class TestOOoImport(TestOOoImportMixin):
...
@@ -821,7 +821,7 @@ class TestOOoImport(TestOOoImportMixin):
try
:
try
:
self
.
portal
.
portal_categories
.
Base_getCategoriesSpreadSheetMapping
(
self
.
portal
.
portal_categories
.
Base_getCategoriesSpreadSheetMapping
(
import_file
=
import_file
)
import_file
=
import_file
)
except
ValueError
,
error
:
except
ValueError
as
error
:
# 'france' is the duplicate ID in this spreadsheet
# 'france' is the duplicate ID in this spreadsheet
self
.
assertTrue
(
'france'
in
str
(
error
),
str
(
error
))
self
.
assertTrue
(
'france'
in
str
(
error
),
str
(
error
))
else
:
else
:
...
@@ -850,7 +850,7 @@ class TestOOoImport(TestOOoImportMixin):
...
@@ -850,7 +850,7 @@ class TestOOoImport(TestOOoImportMixin):
try
:
try
:
self
.
portal
.
portal_categories
.
Base_getCategoriesSpreadSheetMapping
(
self
.
portal
.
portal_categories
.
Base_getCategoriesSpreadSheetMapping
(
import_file
=
import_file
)
import_file
=
import_file
)
except
ValueError
,
error
:
except
ValueError
as
error
:
# 'wrong_hierarchy' is the ID of the category where the problem happens
# 'wrong_hierarchy' is the ID of the category where the problem happens
self
.
assertTrue
(
'wrong_hierarchy'
in
str
(
error
),
str
(
error
))
self
.
assertTrue
(
'wrong_hierarchy'
in
str
(
error
),
str
(
error
))
else
:
else
:
...
@@ -864,7 +864,7 @@ class TestOOoImport(TestOOoImportMixin):
...
@@ -864,7 +864,7 @@ class TestOOoImport(TestOOoImportMixin):
try
:
try
:
self
.
portal
.
portal_categories
.
Base_getCategoriesSpreadSheetMapping
(
self
.
portal
.
portal_categories
.
Base_getCategoriesSpreadSheetMapping
(
import_file
=
import_file
)
import_file
=
import_file
)
except
ValueError
,
error
:
except
ValueError
as
error
:
self
.
assertTrue
(
'More that one path is defined'
in
str
(
error
),
str
(
error
))
self
.
assertTrue
(
'More that one path is defined'
in
str
(
error
),
str
(
error
))
else
:
else
:
self
.
fail
(
'ValueError not raised'
)
self
.
fail
(
'ValueError not raised'
)
...
...
product/ERP5Type/patches/DCWorkflow.py
View file @
a7d4459c
...
@@ -141,7 +141,7 @@ def DCWorkflowDefinition_listGlobalActions(self, info):
...
@@ -141,7 +141,7 @@ def DCWorkflowDefinition_listGlobalActions(self, info):
# Patch to automatically filter workflists per portal type
# Patch to automatically filter workflists per portal type
# so that the same state can be used for different
# so that the same state can be used for different
# worklists and they are not merged
# worklists and they are not merged
if
not
dict
.
has_key
(
'portal_type'
)
:
if
'portal_type'
not
in
dict
:
dict
[
'portal_type'
]
=
portal_type_list
dict
[
'portal_type'
]
=
portal_type_list
# Patch for ERP5 by JP Smets in order
# Patch for ERP5 by JP Smets in order
# to implement worklists and search of local roles
# to implement worklists and search of local roles
...
@@ -255,11 +255,11 @@ def DCWorkflowDefinition_executeTransition(self, ob, tdef=None, kwargs=None):
...
@@ -255,11 +255,11 @@ def DCWorkflowDefinition_executeTransition(self, ob, tdef=None, kwargs=None):
try
:
try
:
#LOG('_executeTransition', 0, "script = %s, sci = %s" % (repr(script), repr(sci)))
#LOG('_executeTransition', 0, "script = %s, sci = %s" % (repr(script), repr(sci)))
script
(
sci
)
# May throw an exception.
script
(
sci
)
# May throw an exception.
except
ValidationFailed
,
validation_exc
:
except
ValidationFailed
as
validation_exc
:
before_script_success
=
0
before_script_success
=
0
before_script_error_message
=
deepcopy
(
validation_exc
.
msg
)
before_script_error_message
=
deepcopy
(
validation_exc
.
msg
)
validation_exc_traceback
=
sys
.
exc_traceback
validation_exc_traceback
=
sys
.
exc_traceback
except
ObjectMoved
,
moved_exc
:
except
ObjectMoved
as
moved_exc
:
ob
=
moved_exc
.
getNewObject
()
ob
=
moved_exc
.
getNewObject
()
# Re-raise after transition
# Re-raise after transition
...
@@ -274,11 +274,11 @@ def DCWorkflowDefinition_executeTransition(self, ob, tdef=None, kwargs=None):
...
@@ -274,11 +274,11 @@ def DCWorkflowDefinition_executeTransition(self, ob, tdef=None, kwargs=None):
if
not
vdef
.
for_status
:
if
not
vdef
.
for_status
:
continue
continue
expr
=
None
expr
=
None
if
state_values
.
has_key
(
id
)
:
if
id
in
state_values
:
value
=
state_values
[
id
]
value
=
state_values
[
id
]
elif
tdef_exprs
.
has_key
(
id
)
:
elif
id
in
tdef_exprs
:
expr
=
tdef_exprs
[
id
]
expr
=
tdef_exprs
[
id
]
elif
not
vdef
.
update_always
and
former_status
.
has_key
(
id
)
:
elif
not
vdef
.
update_always
and
id
in
former_status
:
# Preserve former value
# Preserve former value
value
=
former_status
[
id
]
value
=
former_status
[
id
]
else
:
else
:
...
@@ -387,11 +387,11 @@ def _executeMetaTransition(self, ob, new_state_id):
...
@@ -387,11 +387,11 @@ def _executeMetaTransition(self, ob, new_state_id):
if
not
vdef
.
for_status
:
if
not
vdef
.
for_status
:
continue
continue
expr
=
None
expr
=
None
if
state_values
.
has_key
(
id
)
:
if
id
in
state_values
:
value
=
state_values
[
id
]
value
=
state_values
[
id
]
elif
tdef_exprs
.
has_key
(
id
)
:
elif
id
in
tdef_exprs
:
expr
=
tdef_exprs
[
id
]
expr
=
tdef_exprs
[
id
]
elif
not
vdef
.
update_always
and
former_status
.
has_key
(
id
)
:
elif
not
vdef
.
update_always
and
id
in
former_status
:
# Preserve former value
# Preserve former value
value
=
former_status
[
id
]
value
=
former_status
[
id
]
else
:
else
:
...
...
product/ERP5Type/patches/WorkflowTool.py
View file @
a7d4459c
...
@@ -141,7 +141,7 @@ class WorkflowMethod( Method ):
...
@@ -141,7 +141,7 @@ class WorkflowMethod( Method ):
# No workflow tool found.
# No workflow tool found.
try
:
try
:
res
=
self
.
_m
(
instance
,
*
args
,
**
kw
)
res
=
self
.
_m
(
instance
,
*
args
,
**
kw
)
except
ObjectDeleted
,
ex
:
except
ObjectDeleted
as
ex
:
res
=
ex
.
getResult
()
res
=
ex
.
getResult
()
else
:
else
:
if
hasattr
(
aq_base
(
instance
),
'reindexObject'
):
if
hasattr
(
aq_base
(
instance
),
'reindexObject'
):
...
...
product/ERP5Type/patches/sqltest.py
View file @
a7d4459c
...
@@ -29,7 +29,7 @@ if 1: # For easy diff with original
...
@@ -29,7 +29,7 @@ if 1: # For easy diff with original
else
:
else
:
v
=
expr
(
md
)
v
=
expr
(
md
)
except
(
KeyError
,
NameError
):
except
(
KeyError
,
NameError
):
if
args
.
has_key
(
'optional'
)
and
args
[
'optional'
]:
if
'optional'
in
args
and
args
[
'optional'
]:
return
''
return
''
raise
ValueError
(
'Missing input variable, <em>%s</em>'
%
name
)
raise
ValueError
(
'Missing input variable, <em>%s</em>'
%
name
)
...
@@ -80,7 +80,7 @@ if 1: # For easy diff with original
...
@@ -80,7 +80,7 @@ if 1: # For easy diff with original
vs
.
append
(
v
)
vs
.
append
(
v
)
if
not
vs
and
t
==
'nb'
:
if
not
vs
and
t
==
'nb'
:
if
args
.
has_key
(
'optional'
)
and
args
[
'optional'
]:
if
'optional'
in
args
and
args
[
'optional'
]:
return
''
return
''
else
:
else
:
raise
ValueError
(
raise
ValueError
(
...
...
product/ERP5Type/tests/ERP5TypeFunctionalTestCase.py
View file @
a7d4459c
...
@@ -474,7 +474,7 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
...
@@ -474,7 +474,7 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
error
=
[]
error
=
[]
try
:
try
:
iframe
=
self
.
runner
.
test
(
debug
=
debug
)
iframe
=
self
.
runner
.
test
(
debug
=
debug
)
except
TimeoutError
,
e
:
except
TimeoutError
as
e
:
error
.
append
(
repr
(
e
))
error
.
append
(
repr
(
e
))
try
:
try
:
self
.
tic
()
self
.
tic
()
...
...
product/ERP5Type/tests/ERP5TypeTestCase.py
View file @
a7d4459c
...
@@ -21,7 +21,7 @@ import traceback
...
@@ -21,7 +21,7 @@ import traceback
import
urllib
import
urllib
import
ConfigParser
import
ConfigParser
from
contextlib
import
contextmanager
from
contextlib
import
contextmanager
from
cStringIO
import
StringIO
from
six.moves
import
cStringIO
as
StringIO
from
cPickle
import
dumps
from
cPickle
import
dumps
from
glob
import
glob
from
glob
import
glob
from
hashlib
import
md5
from
hashlib
import
md5
...
@@ -1558,7 +1558,7 @@ class ZEOServerTestCase(ERP5TypeTestCase):
...
@@ -1558,7 +1558,7 @@ class ZEOServerTestCase(ERP5TypeTestCase):
try
:
try
:
self
.
zeo_server
=
StorageServer
(
host_port
,
storage
)
self
.
zeo_server
=
StorageServer
(
host_port
,
storage
)
break
break
except
socket
.
error
,
e
:
except
socket
.
error
as
e
:
if
e
[
0
]
!=
errno
.
EADDRINUSE
:
if
e
[
0
]
!=
errno
.
EADDRINUSE
:
raise
raise
if
zeo_client
:
if
zeo_client
:
...
...
product/ERP5Type/tests/ERP5TypeTestSuite.py
View file @
a7d4459c
...
@@ -32,7 +32,7 @@ class ERP5TypeTestSuite(TestSuite):
...
@@ -32,7 +32,7 @@ class ERP5TypeTestSuite(TestSuite):
if self.log_directory:
if self.log_directory:
args = ('--log_directory', self.getLogDirectoryPath(*args, **kw), ) + args
args = ('--log_directory', self.getLogDirectoryPath(*args, **kw), ) + args
if
self.__dict__.has_key("
bt5_path
")
:
if
"
bt5_path
" in self.__dict__
:
args = ("
--
bt5_path
=%
s
" % self.bt5_path,) + args
args = ("
--
bt5_path
=%
s
" % self.bt5_path,) + args
instance_number = self.instance or 1
instance_number = self.instance or 1
if self.zserver_address_list:
if self.zserver_address_list:
...
@@ -71,7 +71,7 @@ class ERP5TypeTestSuite(TestSuite):
...
@@ -71,7 +71,7 @@ class ERP5TypeTestSuite(TestSuite):
+ ('--verbose', '--erp5_sql_connection_string=' + mysql_db_list[0])
\
+ ('--verbose', '--erp5_sql_connection_string=' + mysql_db_list[0])
\
+ args
+ args
status_dict = self.spawn(*args, **kw)
status_dict = self.spawn(*args, **kw)
except SubprocessError
,
e:
except SubprocessError
as
e:
status_dict = e.status_dict
status_dict = e.status_dict
test_log = status_dict['stderr']
test_log = status_dict['stderr']
search = self.RUN_RE.search(test_log)
search = self.RUN_RE.search(test_log)
...
@@ -157,7 +157,7 @@ class SavedTestSuite(ERP5TypeTestSuite):
...
@@ -157,7 +157,7 @@ class SavedTestSuite(ERP5TypeTestSuite):
return super(SavedTestSuite, self).getLogDirectoryPath(*args, **kw)
return super(SavedTestSuite, self).getLogDirectoryPath(*args, **kw)
def __runUnitTest(self, *args, **kw):
def __runUnitTest(self, *args, **kw):
if
self.__dict__.has_key("
bt5_path
")
:
if
"
bt5_path
" in self.__dict__
:
args = ("
--
bt5_path
=%
s
" % self.bt5_path,) + args
args = ("
--
bt5_path
=%
s
" % self.bt5_path,) + args
return super(SavedTestSuite, self).runUnitTest(
return super(SavedTestSuite, self).runUnitTest(
'--portal_id=' + self._portal_id,
'--portal_id=' + self._portal_id,
...
...
product/ERP5Type/tests/ProcessingNodeTestCase.py
View file @
a7d4459c
...
@@ -319,7 +319,7 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
...
@@ -319,7 +319,7 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
error_message
=
'tic is looping forever. '
error_message
=
'tic is looping forever. '
try
:
try
:
self
.
assertNoPendingMessage
()
self
.
assertNoPendingMessage
()
except
AssertionError
,
e
:
except
AssertionError
as
e
:
error_message
+=
str
(
e
)
error_message
+=
str
(
e
)
raise
RuntimeError
(
error_message
)
raise
RuntimeError
(
error_message
)
# This give some time between messages
# This give some time between messages
...
...
product/ERP5Type/tests/Python3StyleTest.py
View file @
a7d4459c
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
import
os
,
sys
import
os
,
sys
import
unittest
import
unittest
from
subprocess
import
check_output
,
CalledProcessError
from
subprocess
import
check_output
,
CalledProcessError
from
cStringIO
import
StringIO
from
six.moves
import
cStringIO
as
StringIO
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
lib2to3.main
import
main
from
lib2to3.main
import
main
...
...
product/ERP5Type/tests/runUnitTest.py
View file @
a7d4459c
...
@@ -787,7 +787,7 @@ def main(argument_list=None):
...
@@ -787,7 +787,7 @@ def main(argument_list=None):
"log_directory="
,
"log_directory="
,
"with_wendelin_core"
"with_wendelin_core"
])
])
except
getopt
.
GetoptError
,
msg
:
except
getopt
.
GetoptError
as
msg
:
usage
(
sys
.
stderr
,
msg
)
usage
(
sys
.
stderr
,
msg
)
sys
.
exit
(
2
)
sys
.
exit
(
2
)
...
...
product/ERP5Type/tests/testDynamicClassGeneration.py
View file @
a7d4459c
...
@@ -2782,7 +2782,7 @@ class TestGC(XMLObject):
...
@@ -2782,7 +2782,7 @@ class TestGC(XMLObject):
import
gc
import
gc
initial_gc_debug_flags
=
gc
.
get_debug
()
initial_gc_debug_flags
=
gc
.
get_debug
()
initial_stderr
=
sys
.
stderr
initial_stderr
=
sys
.
stderr
from
cStringIO
import
StringIO
from
six.moves
import
cStringIO
as
StringIO
stderr
=
StringIO
()
stderr
=
StringIO
()
try
:
try
:
gc
.
disable
()
gc
.
disable
()
...
...
product/ERP5Type/tests/utils.py
View file @
a7d4459c
...
@@ -399,7 +399,7 @@ def createZServer(log=os.devnull, zserver_type='http'):
...
@@ -399,7 +399,7 @@ def createZServer(log=os.devnull, zserver_type='http'):
hs
.
__init__
(
ip
,
port
,
resolver
=
None
,
logger_object
=
lg
)
hs
.
__init__
(
ip
,
port
,
resolver
=
None
,
logger_object
=
lg
)
hs
.
install_handler
(
zhandler_class
(
module
=
'Zope2'
,
uri_base
=
''
))
hs
.
install_handler
(
zhandler_class
(
module
=
'Zope2'
,
uri_base
=
''
))
return
hs
return
hs
except
socket
.
error
,
e
:
except
socket
.
error
as
e
:
if
e
[
0
]
!=
errno
.
EADDRINUSE
:
if
e
[
0
]
!=
errno
.
EADDRINUSE
:
raise
raise
hs
.
close
()
hs
.
close
()
...
...
product/Formulator/tests/testFormValidator.py
View file @
a7d4459c
...
@@ -22,13 +22,13 @@ class TestField:
...
@@ -22,13 +22,13 @@ class TestField:
return
"utf-8"
return
"utf-8"
def
has_value
(
self
,
id
):
def
has_value
(
self
,
id
):
return
self
.
kw
.
has_key
(
id
)
return
id
in
self
.
kw
class
ValidatorTestCase
(
unittest
.
TestCase
):
class
ValidatorTestCase
(
unittest
.
TestCase
):
def
assertValidatorRaises
(
self
,
exception
,
error_key
,
f
,
*
args
,
**
kw
):
def
assertValidatorRaises
(
self
,
exception
,
error_key
,
f
,
*
args
,
**
kw
):
try
:
try
:
apply
(
f
,
args
,
kw
)
apply
(
f
,
args
,
kw
)
except
exception
,
e
:
except
exception
as
e
:
if
hasattr
(
e
,
'error_key'
)
and
e
.
error_key
!=
error_key
:
if
hasattr
(
e
,
'error_key'
)
and
e
.
error_key
!=
error_key
:
self
.
fail
(
'Got wrong error. Expected %s received %s'
%
self
.
fail
(
'Got wrong error. Expected %s received %s'
%
(
error_key
,
e
))
(
error_key
,
e
))
...
...
product/Formulator/tests/testSerializeForm.py
View file @
a7d4459c
...
@@ -211,14 +211,14 @@ class SerializeTestCase(unittest.TestCase):
...
@@ -211,14 +211,14 @@ class SerializeTestCase(unittest.TestCase):
try
:
try
:
form
.
validate_all
(
request
)
form
.
validate_all
(
request
)
self
.
fail
(
'form should fail in validation'
)
self
.
fail
(
'form should fail in validation'
)
except
FormValidationError
,
e
:
except
FormValidationError
as
e
:
self
.
assertEqual
(
1
,
len
(
e
.
errors
))
self
.
assertEqual
(
1
,
len
(
e
.
errors
))
text1
=
e
.
errors
[
0
].
error_text
text1
=
e
.
errors
[
0
].
error_text
try
:
try
:
form2
.
validate_all
(
request
)
form2
.
validate_all
(
request
)
self
.
fail
(
'form2 should fail in validation'
)
self
.
fail
(
'form2 should fail in validation'
)
except
FormValidationError
,
e
:
except
FormValidationError
as
e
:
self
.
assertEqual
(
1
,
len
(
e
.
errors
))
self
.
assertEqual
(
1
,
len
(
e
.
errors
))
text2
=
e
.
errors
[
0
].
error_text
text2
=
e
.
errors
[
0
].
error_text
...
@@ -344,7 +344,7 @@ class SerializeTestCase(unittest.TestCase):
...
@@ -344,7 +344,7 @@ class SerializeTestCase(unittest.TestCase):
})
})
empty_field
.
manage_edit
(
REQUEST
=
request
)
empty_field
.
manage_edit
(
REQUEST
=
request
)
except
ValidationError
,
e
:
except
ValidationError
as
e
:
self
.
fail
(
'error when editing field %s; error message: %s'
%
self
.
fail
(
'error when editing field %s; error message: %s'
%
(
e
.
field_id
,
e
.
error_text
)
)
(
e
.
field_id
,
e
.
error_text
)
)
...
@@ -400,14 +400,14 @@ class SerializeTestCase(unittest.TestCase):
...
@@ -400,14 +400,14 @@ class SerializeTestCase(unittest.TestCase):
request
[
'field_empty_field'
]
=
''
request
[
'field_empty_field'
]
=
''
try
:
try
:
result1
=
form
.
validate_all
(
request
)
result1
=
form
.
validate_all
(
request
)
except
FormValidationError
,
e
:
except
FormValidationError
as
e
:
# XXX only render first error ...
# XXX only render first error ...
self
.
fail
(
'error when editing form1, field %s; error message: %s'
%
self
.
fail
(
'error when editing form1, field %s; error message: %s'
%
(
e
.
errors
[
0
].
field_id
,
e
.
errors
[
0
].
error_text
)
)
(
e
.
errors
[
0
].
field_id
,
e
.
errors
[
0
].
error_text
)
)
try
:
try
:
result2
=
form2
.
validate_all
(
request
)
result2
=
form2
.
validate_all
(
request
)
except
FormValidationError
,
e
:
except
FormValidationError
as
e
:
# XXX only render first error ...
# XXX only render first error ...
self
.
fail
(
'error when editing form1, field %s; error message: %s'
%
self
.
fail
(
'error when editing form1, field %s; error message: %s'
%
(
e
.
errors
[
0
].
field_id
,
e
.
errors
[
0
].
error_text
)
)
(
e
.
errors
[
0
].
field_id
,
e
.
errors
[
0
].
error_text
)
)
...
...
product/HBTreeFolder2/tests/testHBTreeFolder2.py
View file @
a7d4459c
...
@@ -99,7 +99,7 @@ class HBTreeFolder2Tests(ERP5TypeTestCase):
...
@@ -99,7 +99,7 @@ class HBTreeFolder2Tests(ERP5TypeTestCase):
def
testHasKey
(
self
):
def
testHasKey
(
self
):
self
.
assert_
(
self
.
f
.
hasObject
(
'item'
))
# Old spelling
self
.
assert_
(
self
.
f
.
hasObject
(
'item'
))
# Old spelling
self
.
assert_
(
self
.
f
.
has_key
(
'item'
)
)
# New spelling
self
.
assert_
(
'item'
in
self
.
f
)
# New spelling
def
testDelete
(
self
):
def
testDelete
(
self
):
self
.
f
.
_delOb
(
'item'
)
self
.
f
.
_delOb
(
'item'
)
...
@@ -117,7 +117,7 @@ class HBTreeFolder2Tests(ERP5TypeTestCase):
...
@@ -117,7 +117,7 @@ class HBTreeFolder2Tests(ERP5TypeTestCase):
def
testSetObject
(
self
):
def
testSetObject
(
self
):
f2
=
HBTreeFolder2
(
'item2'
)
f2
=
HBTreeFolder2
(
'item2'
)
self
.
f
.
_setObject
(
f2
.
id
,
f2
)
self
.
f
.
_setObject
(
f2
.
id
,
f2
)
self
.
assert_
(
self
.
f
.
has_key
(
'item2'
)
)
self
.
assert_
(
'item2'
in
self
.
f
)
self
.
assertEqual
(
self
.
f
.
objectCount
(),
2
)
self
.
assertEqual
(
self
.
f
.
objectCount
(),
2
)
def
testWrapped
(
self
):
def
testWrapped
(
self
):
...
@@ -153,7 +153,7 @@ class HBTreeFolder2Tests(ERP5TypeTestCase):
...
@@ -153,7 +153,7 @@ class HBTreeFolder2Tests(ERP5TypeTestCase):
old_f
.
_setObject
(
inner_f
.
id
,
inner_f
)
old_f
.
_setObject
(
inner_f
.
id
,
inner_f
)
self
.
ff
.
_populateFromFolder
(
old_f
)
self
.
ff
.
_populateFromFolder
(
old_f
)
self
.
assertEqual
(
self
.
ff
.
objectCount
(),
1
)
self
.
assertEqual
(
self
.
ff
.
objectCount
(),
1
)
self
.
assert_
(
self
.
ff
.
has_key
(
'inner'
)
)
self
.
assert_
(
'inner'
in
self
.
ff
)
self
.
assertEqual
(
self
.
getBase
(
self
.
ff
.
_getOb
(
'inner'
)),
inner_f
)
self
.
assertEqual
(
self
.
getBase
(
self
.
ff
.
_getOb
(
'inner'
)),
inner_f
)
def
testObjectListing
(
self
):
def
testObjectListing
(
self
):
...
...
product/MailTemplates/tests/test_FSMailTemplate.py
View file @
a7d4459c
...
@@ -127,7 +127,7 @@ else:
...
@@ -127,7 +127,7 @@ else:
from
zExceptions
import
Redirect
from
zExceptions
import
Redirect
try
:
try
:
self
.
assertRaises
(
self
.
ob
.
fake_skin
.
test
.
manage_workspace
(
self
.
r
))
self
.
assertRaises
(
self
.
ob
.
fake_skin
.
test
.
manage_workspace
(
self
.
r
))
except
Redirect
,
r
:
except
Redirect
as
r
:
# this may appear to be incorrect, but http://foo/test_mt
# this may appear to be incorrect, but http://foo/test_mt
# is what we set as REQUEST['URL1']
# is what we set as REQUEST['URL1']
self
.
assertEqual
(
r
.
args
,(
'http://foo/test_mt/manage_main'
,))
self
.
assertEqual
(
r
.
args
,(
'http://foo/test_mt/manage_main'
,))
...
...
product/MailTemplates/tests/test_MailTemplate.py
View file @
a7d4459c
...
@@ -14,7 +14,7 @@ except ImportError:
...
@@ -14,7 +14,7 @@ except ImportError:
from
AccessControl.SecurityManagement
import
newSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
from
AccessControl.SecurityManagement
import
noSecurityManager
from
AccessControl.SecurityManagement
import
noSecurityManager
from
AccessControl.User
import
system
as
SystemUser
,
SimpleUser
from
AccessControl.User
import
system
as
SystemUser
,
SimpleUser
from
cStringIO
import
StringIO
from
six.moves
import
cStringIO
as
StringIO
from
difflib
import
unified_diff
from
difflib
import
unified_diff
from
Products.MailHost.MailHost
import
MailHost
from
Products.MailHost.MailHost
import
MailHost
from
Testing.makerequest
import
makerequest
from
Testing.makerequest
import
makerequest
...
@@ -325,7 +325,7 @@ class TestMailTemplate(TestCase):
...
@@ -325,7 +325,7 @@ class TestMailTemplate(TestCase):
from
zExceptions
import
Redirect
from
zExceptions
import
Redirect
try
:
try
:
self
.
assertRaises
(
self
.
mt
.
manage_workspace
(
self
.
r
))
self
.
assertRaises
(
self
.
mt
.
manage_workspace
(
self
.
r
))
except
Redirect
,
r
:
except
Redirect
as
r
:
# this may appear to be incorrect, but http://foo/test_mt
# this may appear to be incorrect, but http://foo/test_mt
# is what we set as REQUEST['URL1']
# is what we set as REQUEST['URL1']
self
.
assertEqual
(
r
.
args
,(
'http://foo/test_mt/pt_editForm'
,))
self
.
assertEqual
(
r
.
args
,(
'http://foo/test_mt/pt_editForm'
,))
...
@@ -378,7 +378,7 @@ class TestMailTemplate(TestCase):
...
@@ -378,7 +378,7 @@ class TestMailTemplate(TestCase):
self
.
test_add
(
'Test Body'
)
self
.
test_add
(
'Test Body'
)
try
:
try
:
self
.
mt
.
send
(
**
params
)
self
.
mt
.
send
(
**
params
)
except
TypeError
,
e
:
except
TypeError
as
e
:
self
.
assertEqual
(
e
.
args
[
0
],
error
)
self
.
assertEqual
(
e
.
args
[
0
],
error
)
else
:
else
:
self
.
fail
(
'Mail sent even though params missing'
)
self
.
fail
(
'Mail sent even though params missing'
)
...
...
product/PortalTransforms/libtransforms/utils.py
View file @
a7d4459c
...
@@ -163,7 +163,7 @@ class StrippingParser( SGMLParser ):
...
@@ -163,7 +163,7 @@ class StrippingParser( SGMLParser ):
def
handle_entityref
(
self
,
name
):
def
handle_entityref
(
self
,
name
):
if
self
.
entitydefs
.
has_key
(
name
)
:
if
name
in
self
.
entitydefs
:
x
=
';'
x
=
';'
else
:
else
:
# this breaks unstandard entities that end with ';'
# this breaks unstandard entities that end with ';'
...
@@ -175,7 +175,7 @@ class StrippingParser( SGMLParser ):
...
@@ -175,7 +175,7 @@ class StrippingParser( SGMLParser ):
""" Delete all tags except for legal ones.
""" Delete all tags except for legal ones.
"""
"""
if
VALID_TAGS
.
has_key
(
tag
)
:
if
tag
in
VALID_TAGS
:
self
.
result
=
self
.
result
+
'<'
+
tag
self
.
result
=
self
.
result
+
'<'
+
tag
...
...
product/PortalTransforms/transforms/python.py
View file @
a7d4459c
...
@@ -64,13 +64,11 @@ class Parser:
...
@@ -64,13 +64,11 @@ class Parser:
msg
,
self
.
raw
[
self
.
lines
[
line
]:]))
msg
,
self
.
raw
[
self
.
lines
[
line
]:]))
self
.
out
.
write
(
'
\
n
</pre>
\
n
'
)
self
.
out
.
write
(
'
\
n
</pre>
\
n
'
)
def
__call__
(
self
,
toktype
,
toktext
,
(
srow
,
scol
),
(
erow
,
ecol
)
,
line
):
def
__call__
(
self
,
toktype
,
toktext
,
sx
,
ex
,
line
):
""" Token handler.
""" Token handler.
"""
"""
#print "type", toktype, token.tok_name[toktype], "text", toktext,
(
srow
,
scol
)
=
sx
#print "start", srow,scol, "end", erow,ecol, "<br>"
(
erow
,
ecol
)
=
ex
## calculate new positions
oldpos
=
self
.
pos
oldpos
=
self
.
pos
newpos
=
self
.
lines
[
srow
]
+
scol
newpos
=
self
.
lines
[
srow
]
+
scol
self
.
pos
=
newpos
+
len
(
toktext
)
self
.
pos
=
newpos
+
len
(
toktext
)
...
...
product/ZMySQLDA/tests/testDeferredConnection.py
View file @
a7d4459c
...
@@ -136,7 +136,7 @@ class TestDeferredConnection(ERP5TypeTestCase):
...
@@ -136,7 +136,7 @@ class TestDeferredConnection(ERP5TypeTestCase):
try
:
try
:
try
:
try
:
self
.
commit
()
self
.
commit
()
except
OperationalError
,
m
:
except
OperationalError
as
m
:
if
m
[
0
]
not
in
hosed_connection
:
if
m
[
0
]
not
in
hosed_connection
:
raise
raise
else
:
else
:
...
...
product/Zelenium/generator.py
View file @
a7d4459c
...
@@ -10,7 +10,7 @@ import re
...
@@ -10,7 +10,7 @@ import re
import
getopt
import
getopt
import
glob
import
glob
import
cgi
import
cgi
import
six.moves
import
.
urllib
from
six.moves
import
urllib
import
multifile
import
multifile
if
six
.
PY2
:
if
six
.
PY2
:
from
email
import
message_from_file
as
message_from_bytes
from
email
import
message_from_file
as
message_from_bytes
...
...
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