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
1
Merge Requests
1
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
Boxiang Sun
erp5
Commits
4e0c0864
Commit
4e0c0864
authored
Jan 08, 2018
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using random int as the uid of Activity
parent
1ee36c3b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
15 deletions
+25
-15
product/CMFActivity/Activity/SQLBase.py
product/CMFActivity/Activity/SQLBase.py
+25
-15
No files found.
product/CMFActivity/Activity/SQLBase.py
View file @
4e0c0864
...
@@ -28,6 +28,8 @@
...
@@ -28,6 +28,8 @@
import
sys
import
sys
import
transaction
import
transaction
import
random
from
MySQLdb.constants.ER
import
DUP_ENTRY
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
Shared.DC.ZRDB.Results
import
Results
from
Shared.DC.ZRDB.Results
import
Results
from
Shared.DC.ZRDB.DA
import
DatabaseError
from
Shared.DC.ZRDB.DA
import
DatabaseError
...
@@ -122,8 +124,6 @@ class SQLBase(Queue):
...
@@ -122,8 +124,6 @@ class SQLBase(Queue):
portal
=
activity_tool
.
getPortalObject
()
portal
=
activity_tool
.
getPortalObject
()
for
i
in
xrange
(
0
,
len
(
registered_message_list
),
MAX_MESSAGE_LIST_SIZE
):
for
i
in
xrange
(
0
,
len
(
registered_message_list
),
MAX_MESSAGE_LIST_SIZE
):
message_list
=
registered_message_list
[
i
:
i
+
MAX_MESSAGE_LIST_SIZE
]
message_list
=
registered_message_list
[
i
:
i
+
MAX_MESSAGE_LIST_SIZE
]
uid_list
=
portal
.
portal_ids
.
generateNewIdList
(
self
.
uid_group
,
id_count
=
len
(
message_list
),
id_generator
=
'uid'
)
path_list
=
[
'/'
.
join
(
m
.
object_path
)
for
m
in
message_list
]
path_list
=
[
'/'
.
join
(
m
.
object_path
)
for
m
in
message_list
]
active_process_uid_list
=
[
m
.
active_process_uid
for
m
in
message_list
]
active_process_uid_list
=
[
m
.
active_process_uid
for
m
in
message_list
]
method_id_list
=
[
m
.
method_id
for
m
in
message_list
]
method_id_list
=
[
m
.
method_id
for
m
in
message_list
]
...
@@ -137,19 +137,29 @@ class SQLBase(Queue):
...
@@ -137,19 +137,29 @@ class SQLBase(Queue):
for
m
in
message_list
:
for
m
in
message_list
:
m
.
order_validation_text
=
x
=
self
.
getOrderValidationText
(
m
)
m
.
order_validation_text
=
x
=
self
.
getOrderValidationText
(
m
)
processing_node_list
.
append
(
0
if
x
==
'none'
else
-
1
)
processing_node_list
.
append
(
0
if
x
==
'none'
else
-
1
)
portal
.
SQLBase_writeMessageList
(
for
i
in
range
(
10
):
table
=
self
.
sql_table
,
try
:
uid_list
=
uid_list
,
uid_list
=
[
random
.
randrange
(
0
,
0x7fffffff
)
for
_
in
range
(
len
(
message_list
))]
path_list
=
path_list
,
portal
.
SQLBase_writeMessageList
(
active_process_uid_list
=
active_process_uid_list
,
table
=
self
.
sql_table
,
method_id_list
=
method_id_list
,
uid_list
=
uid_list
,
priority_list
=
priority_list
,
path_list
=
path_list
,
message_list
=
map
(
Message
.
dump
,
message_list
),
active_process_uid_list
=
active_process_uid_list
,
group_method_id_list
=
group_method_id_list
,
method_id_list
=
method_id_list
,
date_list
=
date_list
,
priority_list
=
priority_list
,
tag_list
=
tag_list
,
message_list
=
map
(
Message
.
dump
,
message_list
),
processing_node_list
=
processing_node_list
,
group_method_id_list
=
group_method_id_list
,
serialization_tag_list
=
serialization_tag_list
)
date_list
=
date_list
,
tag_list
=
tag_list
,
processing_node_list
=
processing_node_list
,
serialization_tag_list
=
serialization_tag_list
)
except
MySQLdb
.
IntegrityError
,
(
code
,
_
):
if
code
!=
DUP_ENTRY
:
raise
else
:
break
else
:
raise
ValueError
(
"Maximum retry for SQLBase_writeMessageList reached"
)
def
getNow
(
self
,
context
):
def
getNow
(
self
,
context
):
"""
"""
...
...
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