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
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
c59dee58
Commit
c59dee58
authored
Oct 13, 2022
by
Kazuhiko Shiozaki
Committed by
Jérome Perrin
May 28, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py2/py3: use exception.args[] instead of exception[].
parent
0fc4c566
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
+16
-16
product/ERP5Type/Tool/WorkflowTool.py
product/ERP5Type/Tool/WorkflowTool.py
+4
-4
product/ZMySQLDA/db.py
product/ZMySQLDA/db.py
+12
-12
No files found.
product/ERP5Type/Tool/WorkflowTool.py
View file @
c59dee58
...
@@ -384,7 +384,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
...
@@ -384,7 +384,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
self
.
Base_zClearWorklistTable
()
self
.
Base_zClearWorklistTable
()
except
ProgrammingError
as
error_value
:
except
ProgrammingError
as
error_value
:
# 1146 = table does not exist
# 1146 = table does not exist
if
error_value
[
0
]
!=
1146
:
if
error_value
.
args
[
0
]
!=
1146
:
raise
raise
self
.
Base_zCreateWorklistTable
()
self
.
Base_zCreateWorklistTable
()
portal_catalog
=
self
.
getPortalObject
().
portal_catalog
portal_catalog
=
self
.
getPortalObject
().
portal_catalog
...
@@ -444,7 +444,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
...
@@ -444,7 +444,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
Base_zInsertIntoWorklistTable
(
**
value_column_dict
)
Base_zInsertIntoWorklistTable
(
**
value_column_dict
)
except
(
ProgrammingError
,
OperationalError
)
as
error_value
:
except
(
ProgrammingError
,
OperationalError
)
as
error_value
:
# OperationalError 1054 = unknown column
# OperationalError 1054 = unknown column
if
isinstance
(
error_value
,
OperationalError
)
and
error_value
[
0
]
!=
1054
:
if
isinstance
(
error_value
,
OperationalError
)
and
error_value
.
args
[
0
]
!=
1054
:
raise
raise
LOG
(
'WorkflowTool'
,
WARNING
,
'Insertion in worklist cache table '
\
LOG
(
'WorkflowTool'
,
WARNING
,
'Insertion in worklist cache table '
\
'failed. Recreating table and retrying.'
,
'failed. Recreating table and retrying.'
,
...
@@ -604,13 +604,13 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
...
@@ -604,13 +604,13 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
continue
continue
except
ProgrammingError
as
error_value
:
except
ProgrammingError
as
error_value
:
# 1146 = table does not exist
# 1146 = table does not exist
if
not
use_cache
or
error_value
[
0
]
!=
1146
:
if
not
use_cache
or
error_value
.
args
[
0
]
!=
1146
:
raise
raise
try
:
try
:
self
.
Base_zCreateWorklistTable
()
self
.
Base_zCreateWorklistTable
()
except
ProgrammingError
as
error_value
:
except
ProgrammingError
as
error_value
:
# 1050 = table exists (alarm run just a bit too late)
# 1050 = table exists (alarm run just a bit too late)
if
error_value
[
0
]
!=
1050
:
if
error_value
.
args
[
0
]
!=
1050
:
raise
raise
if
src__
:
if
src__
:
action_list
.
append
(
catalog_brain_result
)
action_list
.
append
(
catalog_brain_result
)
...
...
product/ZMySQLDA/db.py
View file @
c59dee58
...
@@ -407,14 +407,14 @@ class DB(TM):
...
@@ -407,14 +407,14 @@ class DB(TM):
try
:
try
:
self
.
db
.
query
(
query
)
self
.
db
.
query
(
query
)
except
OperationalError
as
m
:
except
OperationalError
as
m
:
if
m
[
0
]
in
query_syntax_error
:
if
m
.
args
[
0
]
in
query_syntax_error
:
raise
OperationalError
(
m
[
0
],
'%s: %s'
%
(
m
[
1
],
query
))
raise
OperationalError
(
m
.
args
[
0
],
'%s: %s'
%
(
m
.
args
[
1
],
query
))
if
m
[
0
]
in
lock_error
:
if
m
.
args
[
0
]
in
lock_error
:
raise
ConflictError
(
'%s: %s: %s'
%
(
m
[
0
],
m
[
1
],
query
))
raise
ConflictError
(
'%s: %s: %s'
%
(
m
.
args
[
0
],
m
.
args
[
1
],
query
))
if
m
[
0
]
in
query_timeout_error
:
if
m
.
args
[
0
]
in
query_timeout_error
:
raise
TimeoutReachedError
(
'%s: %s: %s'
%
(
m
[
0
],
m
[
1
],
query
))
raise
TimeoutReachedError
(
'%s: %s: %s'
%
(
m
.
args
[
0
],
m
.
args
[
1
],
query
))
if
(
allow_reconnect
or
not
self
.
_use_TM
)
and
\
if
(
allow_reconnect
or
not
self
.
_use_TM
)
and
\
m
[
0
]
in
hosed_connection
:
m
.
args
[
0
]
in
hosed_connection
:
self
.
_forceReconnection
()
self
.
_forceReconnection
()
self
.
db
.
query
(
query
)
self
.
db
.
query
(
query
)
else
:
else
:
...
@@ -422,7 +422,7 @@ class DB(TM):
...
@@ -422,7 +422,7 @@ class DB(TM):
raise
raise
except
ProgrammingError
as
m
:
except
ProgrammingError
as
m
:
if
(
allow_reconnect
or
not
self
.
_use_TM
)
and
\
if
(
allow_reconnect
or
not
self
.
_use_TM
)
and
\
m
[
0
]
in
hosed_connection
:
m
.
args
[
0
]
in
hosed_connection
:
self
.
_forceReconnection
()
self
.
_forceReconnection
()
self
.
db
.
query
(
query
)
self
.
db
.
query
(
query
)
else
:
else
:
...
@@ -431,8 +431,8 @@ class DB(TM):
...
@@ -431,8 +431,8 @@ class DB(TM):
try
:
try
:
return
self
.
db
.
store_result
()
return
self
.
db
.
store_result
()
except
OperationalError
as
m
:
except
OperationalError
as
m
:
if
m
[
0
]
in
query_timeout_error
:
if
m
.
args
[
0
]
in
query_timeout_error
:
raise
TimeoutReachedError
(
'%s: %s: %s'
%
(
m
[
0
],
m
[
1
],
query
))
raise
TimeoutReachedError
(
'%s: %s: %s'
%
(
m
.
args
[
0
],
m
.
args
[
1
],
query
))
else
:
else
:
raise
raise
...
@@ -535,7 +535,7 @@ class DB(TM):
...
@@ -535,7 +535,7 @@ class DB(TM):
except
OperationalError
as
m
:
except
OperationalError
as
m
:
LOG
(
'ZMySQLDA'
,
ERROR
,
"exception during _abort"
,
LOG
(
'ZMySQLDA'
,
ERROR
,
"exception during _abort"
,
error
=
True
)
error
=
True
)
if
m
[
0
]
not
in
hosed_connection
:
if
m
.
args
[
0
]
not
in
hosed_connection
:
raise
raise
def
getMaxAllowedPacket
(
self
):
def
getMaxAllowedPacket
(
self
):
...
@@ -587,7 +587,7 @@ class DB(TM):
...
@@ -587,7 +587,7 @@ class DB(TM):
try:
try:
old_list, old_set, old_default = self._getTableSchema("
`%s`
" % name)
old_list, old_set, old_default = self._getTableSchema("
`%s`
" % name)
except ProgrammingError as e:
except ProgrammingError as e:
if e[0] != ER.NO_SUCH_TABLE or not create_if_not_exists:
if e
.args
[0] != ER.NO_SUCH_TABLE or not create_if_not_exists:
raise
raise
if not src__:
if not src__:
self.query(create_sql)
self.query(create_sql)
...
...
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