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
139
Merge Requests
139
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
b1f484b6
Commit
b1f484b6
authored
Jan 31, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sqlvar py3 ( to check )
parent
e68d845e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testSQLVar.py
...estTemplateItem/portal_components/test.erp5.testSQLVar.py
+7
-7
product/ERP5Type/patches/sqlvar.py
product/ERP5Type/patches/sqlvar.py
+3
-3
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testSQLVar.py
View file @
b1f484b6
...
@@ -38,17 +38,17 @@ class TestSQLVar(ERP5TypeTestCase):
...
@@ -38,17 +38,17 @@ class TestSQLVar(ERP5TypeTestCase):
connection_id
=
'erp5_sql_connection'
,
connection_id
=
'erp5_sql_connection'
,
arguments_src
=
'value'
,
arguments_src
=
'value'
,
src
=
'<dtml-sqlvar value type="string">'
)
src
=
'<dtml-sqlvar value type="string">'
)
self
.
assertEqual
(
sqlmethod
(
value
=
''
,
src__
=
1
),
"''"
)
self
.
assertEqual
(
sqlmethod
(
value
=
''
,
src__
=
1
),
b
"''"
)
self
.
assertEqual
(
sqlmethod
(
value
=
None
,
src__
=
1
),
'null'
)
self
.
assertEqual
(
sqlmethod
(
value
=
None
,
src__
=
1
),
b
'null'
)
sqlmethod
.
edit
(
src
=
'<dtml-sqlvar value type="string" optional>'
)
sqlmethod
.
edit
(
src
=
'<dtml-sqlvar value type="string" optional>'
)
self
.
assertEqual
(
sqlmethod
(
value
=
''
,
src__
=
1
),
"''"
)
self
.
assertEqual
(
sqlmethod
(
value
=
''
,
src__
=
1
),
b
"''"
)
self
.
assertEqual
(
sqlmethod
(
value
=
None
,
src__
=
1
),
'null'
)
self
.
assertEqual
(
sqlmethod
(
value
=
None
,
src__
=
1
),
b
'null'
)
sqlmethod
.
edit
(
src
=
'<dtml-sqlvar value type="nb">'
)
sqlmethod
.
edit
(
src
=
'<dtml-sqlvar value type="nb">'
)
self
.
assertRaises
(
ValueError
,
sqlmethod
,
value
=
''
,
src__
=
1
)
self
.
assertRaises
(
ValueError
,
sqlmethod
,
value
=
''
,
src__
=
1
)
self
.
assertEqual
(
sqlmethod
(
value
=
None
,
src__
=
1
),
'null'
)
self
.
assertEqual
(
sqlmethod
(
value
=
None
,
src__
=
1
),
b
'null'
)
sqlmethod
.
edit
(
src
=
'<dtml-sqlvar value type="nb" optional>'
)
sqlmethod
.
edit
(
src
=
'<dtml-sqlvar value type="nb" optional>'
)
self
.
assertEqual
(
sqlmethod
(
value
=
''
,
src__
=
1
),
'null'
)
self
.
assertEqual
(
sqlmethod
(
value
=
''
,
src__
=
1
),
b
'null'
)
self
.
assertEqual
(
sqlmethod
(
value
=
None
,
src__
=
1
),
'null'
)
self
.
assertEqual
(
sqlmethod
(
value
=
None
,
src__
=
1
),
b
'null'
)
product/ERP5Type/patches/sqlvar.py
View file @
b1f484b6
...
@@ -110,13 +110,13 @@ else: # For easy diff with original (ZSQLMethods 3.14)
...
@@ -110,13 +110,13 @@ else: # For easy diff with original (ZSQLMethods 3.14)
v
=
expr
(
md
)
v
=
expr
(
md
)
except
Exception
:
except
Exception
:
if
'optional'
in
args
and
args
[
'optional'
]:
if
'optional'
in
args
and
args
[
'optional'
]:
return
'null'
return
b
'null'
if
not
isinstance
(
expr
,
StringTypes
):
if
not
isinstance
(
expr
,
StringTypes
):
raise
raise
raise
ValueError
(
'Missing input variable, <em>%s</em>'
%
name
)
raise
ValueError
(
'Missing input variable, <em>%s</em>'
%
name
)
if
v
is
None
:
if
v
is
None
:
return
'null'
return
b
'null'
if
t
==
'int'
:
if
t
==
'int'
:
try
:
try
:
...
@@ -162,7 +162,7 @@ else: # For easy diff with original (ZSQLMethods 3.14)
...
@@ -162,7 +162,7 @@ else: # For easy diff with original (ZSQLMethods 3.14)
v
=
str
(
v
)
v
=
str
(
v
)
if
not
v
and
t
==
'nb'
:
if
not
v
and
t
==
'nb'
:
if
'optional'
in
args
and
args
[
'optional'
]:
if
'optional'
in
args
and
args
[
'optional'
]:
return
'null'
return
b
'null'
else
:
else
:
err
=
'Invalid empty string value for <em>%s</em>'
%
name
err
=
'Invalid empty string value for <em>%s</em>'
%
name
raise
ValueError
(
err
)
raise
ValueError
(
err
)
...
...
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