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
Levin Zimmermann
erp5
Commits
35a22887
Commit
35a22887
authored
Jan 20, 2021
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMFActivity.Activity.SQLBase: Const-ify row2key.
parent
94db4215
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
product/CMFActivity/Activity/SQLBase.py
product/CMFActivity/Activity/SQLBase.py
+6
-4
No files found.
product/CMFActivity/Activity/SQLBase.py
View file @
35a22887
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
from
collections
import
defaultdict
from
collections
import
defaultdict
from
itertools
import
product
from
itertools
import
product
import
operator
import
sys
import
sys
import
transaction
import
transaction
from
random
import
getrandbits
from
random
import
getrandbits
...
@@ -72,6 +73,9 @@ def sort_message_key(message):
...
@@ -72,6 +73,9 @@ def sort_message_key(message):
_DequeueMessageException
=
Exception
()
_DequeueMessageException
=
Exception
()
_ITEMGETTER0
=
operator
.
itemgetter
(
0
)
_IDENTITY
=
lambda
x
:
x
def
render_datetime
(
x
):
def
render_datetime
(
x
):
return
"%.4d-%.2d-%.2d %.2d:%.2d:%09.6f"
%
x
.
toZone
(
'UTC'
).
parts
()[:
6
]
return
"%.4d-%.2d-%.2d %.2d:%.2d:%09.6f"
%
x
.
toZone
(
'UTC'
).
parts
()[:
6
]
...
@@ -525,12 +529,10 @@ CREATE TABLE %s (
...
@@ -525,12 +529,10 @@ CREATE TABLE %s (
continue
continue
column_list
,
to_sql
=
dependency_tester_dict
[
dependency_name
]
column_list
,
to_sql
=
dependency_tester_dict
[
dependency_name
]
if
len
(
column_list
)
==
1
:
if
len
(
column_list
)
==
1
:
def
row2key
(
row
):
row2key
=
_ITEMGETTER0
key
,
=
row
return
key
dependency_sql
=
to_sql
(
dependency_value_dict
.
keys
(),
quote
)
dependency_sql
=
to_sql
(
dependency_value_dict
.
keys
(),
quote
)
else
:
else
:
row2key
=
lambda
x
:
x
row2key
=
_IDENTITY
# XXX: generated SQL could be simpler: for example, a dependency input
# XXX: generated SQL could be simpler: for example, a dependency input
# as
# as
# ('foo', ('bar', 'baz'))
# ('foo', ('bar', 'baz'))
...
...
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