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
141
Merge Requests
141
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
89c5b42b
Commit
89c5b42b
authored
Oct 12, 2024
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP-encode-decode: fixup! fixup! py3: _mysql.string_literal() returns bytes().
parent
5b2fccc8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
product/CMFActivity/Activity/SQLBase.py
product/CMFActivity/Activity/SQLBase.py
+4
-4
product/CMFActivity/Activity/SQLJoblib.py
product/CMFActivity/Activity/SQLJoblib.py
+6
-5
No files found.
product/CMFActivity/Activity/SQLBase.py
View file @
89c5b42b
...
...
@@ -834,8 +834,8 @@ CREATE TABLE %s (
"""
Put messages back in given processing_node.
"""
db
.
query
((
"UPDATE %s SET processing_node=%s WHERE uid IN (%s)
\
0
COMMIT"
%
(
self
.
sql_table
,
state
,
','
.
join
(
map
(
str
,
uid_list
))))
.
encode
()
)
db
.
query
(
str2bytes
(
"UPDATE %s SET processing_node=%s WHERE uid IN (%s)
\
0
COMMIT"
%
(
self
.
sql_table
,
state
,
','
.
join
(
map
(
str
,
uid_list
)))))
def
getProcessableMessageLoader
(
self
,
db
,
processing_node
):
# do not merge anything
...
...
@@ -1208,8 +1208,8 @@ CREATE TABLE %s (
To simulate time shift, we simply substract delay from
all dates in message(_queue) table
"""
activity_tool
.
getSQLConnection
().
query
((
"UPDATE %s SET"
activity_tool
.
getSQLConnection
().
query
(
str2bytes
(
"UPDATE %s SET"
" date = DATE_SUB(date, INTERVAL %s SECOND)"
%
(
self
.
sql_table
,
delay
)
+
(
''
if
processing_node
is
None
else
"WHERE processing_node=%s"
%
processing_node
))
.
encode
()
)
"WHERE processing_node=%s"
%
processing_node
)))
product/CMFActivity/Activity/SQLJoblib.py
View file @
89c5b42b
...
...
@@ -36,6 +36,7 @@ from .SQLBase import (
UID_SAFE_BITSIZE
,
UID_ALLOCATION_TRY_COUNT
,
)
from
Products.CMFActivity.ActivityTool
import
Message
from
Products.ERP5Type.Utils
import
str2bytes
from
.SQLDict
import
SQLDict
from
six.moves
import
xrange
...
...
@@ -92,9 +93,9 @@ CREATE TABLE %s (
if
reset_uid
:
reset_uid
=
False
# Overflow will result into IntegrityError.
db
.
query
(
b"SET @uid := %s"
%
str
(
getrandbits
(
UID_SAFE_BITSIZE
)).
encode
(
))
db
.
query
(
b"SET @uid := %s"
%
str
2bytes
(
str
(
getrandbits
(
UID_SAFE_BITSIZE
))
))
try
:
db
.
query
(
self
.
_insert_template
%
(
s
elf
.
sql_table
.
encode
(
),
values
))
db
.
query
(
self
.
_insert_template
%
(
s
tr2bytes
(
self
.
sql_table
),
values
))
except
MySQLdb
.
IntegrityError
as
e
:
if
e
.
args
[
0
]
!=
DUP_ENTRY
:
raise
...
...
@@ -114,13 +115,13 @@ CREATE TABLE %s (
active_process_uid
=
m
.
active_process_uid
date
=
m
.
activity_kw
.
get
(
'at_date'
)
row
=
b','
.
join
((
b'@uid+%s'
%
str
(
i
).
encode
(
),
b'@uid+%s'
%
str
2bytes
(
str
(
i
)
),
quote
(
'/'
.
join
(
m
.
object_path
)),
b'NULL'
if
active_process_uid
is
None
else
str
(
active_process_uid
).
encode
(
),
b'NULL'
if
active_process_uid
is
None
else
str
2bytes
(
str
(
active_process_uid
)
),
b"UTC_TIMESTAMP(6)"
if
date
is
None
else
quote
(
render_datetime
(
date
)),
quote
(
m
.
method_id
),
b'-1'
if
hasDependency
(
m
)
else
b'0'
,
str
(
m
.
activity_kw
.
get
(
'priority'
,
1
)).
encode
(
),
str
2bytes
(
str
(
m
.
activity_kw
.
get
(
'priority'
,
1
))
),
quote
(
m
.
getGroupId
()),
quote
(
m
.
activity_kw
.
get
(
'tag'
,
''
)),
quote
(
m
.
activity_kw
.
get
(
'signature'
,
''
)),
...
...
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