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
Titouan Soulard
erp5
Commits
b4ef71d7
Commit
b4ef71d7
authored
Mar 29, 2021
by
Aurel
Committed by
Jérome Perrin
Jan 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patches related to cataloging
parent
023abd16
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
8 deletions
+19
-8
product/ERP5Type/patches/sqltest.py
product/ERP5Type/patches/sqltest.py
+10
-3
product/ERP5Type/patches/sqlvar.py
product/ERP5Type/patches/sqlvar.py
+9
-5
No files found.
product/ERP5Type/patches/sqltest.py
View file @
b4ef71d7
...
@@ -51,7 +51,7 @@ if 1: # For easy diff with original
...
@@ -51,7 +51,7 @@ if 1: # For easy diff with original
if
type
(
v
)
is
StringType
:
if
type
(
v
)
is
StringType
:
if
v
[
-
1
:]
==
'L'
:
if
v
[
-
1
:]
==
'L'
:
v
=
v
[:
-
1
]
v
=
v
[:
-
1
]
atoi
(
v
)
int
(
v
)
else
:
v
=
str
(
int
(
v
))
else
:
v
=
str
(
int
(
v
))
except
ValueError
:
except
ValueError
:
raise
ValueError
(
raise
ValueError
(
...
@@ -59,7 +59,7 @@ if 1: # For easy diff with original
...
@@ -59,7 +59,7 @@ if 1: # For easy diff with original
elif
t
==
'float'
:
elif
t
==
'float'
:
if
not
v
and
type
(
v
)
is
StringType
:
continue
if
not
v
and
type
(
v
)
is
StringType
:
continue
try
:
try
:
if
type
(
v
)
is
StringType
:
atof
(
v
)
if
type
(
v
)
is
StringType
:
float
(
v
)
else
:
v
=
str
(
float
(
v
))
else
:
v
=
str
(
float
(
v
))
except
ValueError
:
except
ValueError
:
raise
ValueError
(
raise
ValueError
(
...
@@ -104,4 +104,11 @@ if 1: # For easy diff with original
...
@@ -104,4 +104,11 @@ if 1: # For easy diff with original
return
"%s %s %s"
%
(
self
.
column
,
self
.
op
,
vs
[
0
])
return
"%s %s %s"
%
(
self
.
column
,
self
.
op
,
vs
[
0
])
SQLTest
.
render
=
SQLTest
.
__call__
=
render
SQLTest
.
render
=
SQLTest
.
__call__
=
render
sqltest
.
valid_type
=
((
'int'
,
'float'
,
'string'
,
'nb'
,
'datetime'
)
+
tuple
(
'datetime(%s)'
%
x
for
x
in
xrange
(
7
))).
__contains__
new_valid_types
=
((
'int'
,
'float'
,
'string'
,
'nb'
,
'datetime'
)
+
tuple
(
'datetime(%s)'
%
x
for
x
in
xrange
(
7
)))
try
:
# BBB
from
Shared.DC.ZRDB.sqltest
import
valid_type
sqltest
.
valid_type
=
new_valid_types
.
__contains__
except
ImportError
:
sqltest
.
valid_types
=
new_valid_types
product/ERP5Type/patches/sqlvar.py
View file @
b4ef71d7
...
@@ -83,11 +83,15 @@ def SQLVar_render(self, md):
...
@@ -83,11 +83,15 @@ def SQLVar_render(self, md):
%
(
t
,
self
.
__name__
,
v
))
%
(
t
,
self
.
__name__
,
v
))
# Patched by yo. datetime is added.
# Patched by yo. datetime is added.
new_valid_types
=
'int'
,
'float'
,
'string'
,
'nb'
,
'datetime'
valid_type
=
'int'
,
'float'
,
'string'
,
'nb'
,
'datetime'
new_valid_types
+=
tuple
(
map
(
'datetime(%s)'
.
__mod__
,
xrange
(
7
)))
valid_type
+=
tuple
(
map
(
'datetime(%s)'
.
__mod__
,
xrange
(
7
)))
try
:
valid_type
=
valid_type
.
__contains__
# BBB
from
Shared.DC.ZRDB.sqlvar
import
valid_type
sqlvar
.
valid_type
=
new_valid_types
.
__contains__
except
ImportError
:
sqlvar
.
valid_types
=
new_valid_types
SQLVar
.
render
=
SQLVar_render
SQLVar
.
render
=
SQLVar_render
SQLVar
.
__call__
=
SQLVar_render
SQLVar
.
__call__
=
SQLVar_render
sqlvar
.
valid_type
=
valid_type
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