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
21f85a6f
Commit
21f85a6f
authored
Feb 06, 2023
by
Kazuhiko Shiozaki
Committed by
Jérome Perrin
Mar 03, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Zope2: use func_code if __code__ is missing, that is the case for Script (Python).
parent
55dc4b19
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
2 deletions
+12
-2
product/ERP5/Document/Alarm.py
product/ERP5/Document/Alarm.py
+2
-0
product/ERP5Type/Core/Predicate.py
product/ERP5Type/Core/Predicate.py
+4
-1
product/ZSQLCatalog/SQLCatalog.py
product/ZSQLCatalog/SQLCatalog.py
+6
-1
No files found.
product/ERP5/Document/Alarm.py
View file @
21f85a6f
...
@@ -165,6 +165,8 @@ class Alarm(XMLObject, PeriodicityMixin):
...
@@ -165,6 +165,8 @@ class Alarm(XMLObject, PeriodicityMixin):
tag
=
activate_kw
[
'tag'
]
tag
=
activate_kw
[
'tag'
]
method
=
getattr
(
self
,
method_id
)
method
=
getattr
(
self
,
method_id
)
func_code
=
method
.
__code__
func_code
=
method
.
__code__
if
func_code
is
None
:
# BBB Zope2
func_code
=
method
.
func_code
try
:
try
:
has_kw
=
func_code
.
co_flags
&
CO_VARKEYWORDS
has_kw
=
func_code
.
co_flags
&
CO_VARKEYWORDS
except
AttributeError
:
except
AttributeError
:
...
...
product/ERP5Type/Core/Predicate.py
View file @
21f85a6f
...
@@ -181,7 +181,10 @@ class Predicate(XMLObject):
...
@@ -181,7 +181,10 @@ class Predicate(XMLObject):
try
:
try
:
result
=
method
(
self
)
result
=
method
(
self
)
except
TypeError
:
except
TypeError
:
if
method
.
__code__
.
co_argcount
!=
isinstance
(
method
,
MethodType
):
func_code
=
method
.
__code__
if
func_code
is
None
:
# BBB Zope2
func_code
=
method
.
func_code
if
func_code
.
co_argcount
!=
isinstance
(
method
,
MethodType
):
raise
raise
# backward compatibilty with script that takes no argument
# backward compatibilty with script that takes no argument
warn
(
'Predicate %s uses an old-style method (%s) that does not'
warn
(
'Predicate %s uses an old-style method (%s) that does not'
...
...
product/ZSQLCatalog/SQLCatalog.py
View file @
21f85a6f
...
@@ -1451,7 +1451,10 @@ class Catalog(Folder,
...
@@ -1451,7 +1451,10 @@ class Catalog(Folder,
if
meta_type
in
self
.
HAS_ARGUMENT_SRC_METATYPE_SET
:
if
meta_type
in
self
.
HAS_ARGUMENT_SRC_METATYPE_SET
:
return
method
.
arguments_src
.
split
()
return
method
.
arguments_src
.
split
()
elif
meta_type
in
self
.
HAS_FUNC_CODE_METATYPE_SET
:
elif
meta_type
in
self
.
HAS_FUNC_CODE_METATYPE_SET
:
return
method
.
__code__
.
co_varnames
[:
method
.
__code__
.
co_argcount
]
func_code
=
method
.
__code__
if
func_code
is
None
:
# BBB Zope2
func_code
=
method
.
func_code
return
func_code
.
co_varnames
[:
func_code
.
co_argcount
]
# Note: Raising here would completely prevent indexation from working.
# Note: Raising here would completely prevent indexation from working.
# Instead, let the method actually fail when called, so _catalogObjectList
# Instead, let the method actually fail when called, so _catalogObjectList
# can log the error and carry on.
# can log the error and carry on.
...
@@ -1838,6 +1841,8 @@ class Catalog(Folder,
...
@@ -1838,6 +1841,8 @@ class Catalog(Folder,
search_key
=
self
.
getSearchKey
(
key
,
'RelatedKey'
)
search_key
=
self
.
getSearchKey
(
key
,
'RelatedKey'
)
else
:
else
:
func_code
=
script
.
__code__
func_code
=
script
.
__code__
if
func_code
is
None
:
# BBB Zope2
func_code
=
script
.
func_code
search_key
=
(
search_key
=
(
AdvancedSearchKeyWrapperForScriptableKey
if
(
AdvancedSearchKeyWrapperForScriptableKey
if
(
# 5: search_value (under any name), "search_key", "group",
# 5: search_value (under any name), "search_key", "group",
...
...
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