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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gabriel Monnerat
erp5
Commits
1a39a60e
Commit
1a39a60e
authored
Feb 27, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preserve original file's indentation.
For easier copy/paste from original file.
parent
ea27cd49
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
53 deletions
+54
-53
product/ERP5Type/patches/ExternalMethod.py
product/ERP5Type/patches/ExternalMethod.py
+54
-53
No files found.
product/ERP5Type/patches/ExternalMethod.py
View file @
1a39a60e
...
@@ -14,64 +14,65 @@
...
@@ -14,64 +14,65 @@
from
Products.ExternalMethod.ExternalMethod
import
ExternalMethod
from
Products.ExternalMethod.ExternalMethod
import
ExternalMethod
from
App.Extensions
import
FuncCode
,
getObject
from
App.Extensions
import
FuncCode
,
getObject
def
getFunction
(
self
,
reload
=
False
,
f
=
None
):
if
1
:
"""
def
getFunction
(
self
,
reload
=
False
,
f
=
None
):
Patch to get ZODB Component Extension function if available, otherwise
"""
fallback on filesystem Extension
Patch to get ZODB Component Extension function if available, otherwise
"""
fallback on filesystem Extension
if
f
is
None
:
"""
import
erp5.component.extension
if
f
is
None
:
try
:
import
erp5.component.extension
f
=
getattr
(
getattr
(
erp5
.
component
.
extension
,
self
.
_module
),
try
:
self
.
_function
)
f
=
getattr
(
getattr
(
erp5
.
component
.
extension
,
self
.
_module
),
except
AttributeError
:
self
.
_function
)
f
=
getObject
(
self
.
_module
,
self
.
_function
,
reload
)
except
AttributeError
:
f
=
getObject
(
self
.
_module
,
self
.
_function
,
reload
)
# From ExternalMethod.getFunction
# From ExternalMethod.getFunction
ff
=
getattr
(
f
,
'im_func'
,
f
)
ff
=
getattr
(
f
,
'im_func'
,
f
)
self
.
_v_func_defaults
=
ff
.
func_defaults
self
.
_v_func_defaults
=
ff
.
func_defaults
self
.
_v_func_code
=
FuncCode
(
ff
,
f
is
not
ff
)
self
.
_v_func_code
=
FuncCode
(
ff
,
f
is
not
ff
)
self
.
_v_f
=
f
self
.
_v_f
=
f
return
f
return
f
ExternalMethod
.
getFunction
=
getFunction
ExternalMethod
.
getFunction
=
getFunction
ExternalMethod__call__
=
ExternalMethod
.
__call__
ExternalMethod__call__
=
ExternalMethod
.
__call__
def
__call__
(
self
,
*
args
,
**
kw
):
def
__call__
(
self
,
*
args
,
**
kw
):
"""
"""
Patch to call ZODB Component Extension, by trying first to import ZODB
Patch to call ZODB Component Extension, by trying first to import ZODB
Component Extension if available, otherwise fallback on filesystem
Component Extension if available, otherwise fallback on filesystem
Extension
Extension
"""
"""
try
:
try
:
f
=
getattr
(
__import__
(
'erp5.component.extension.'
+
self
.
_module
,
f
=
getattr
(
__import__
(
'erp5.component.extension.'
+
self
.
_module
,
fromlist
=
[
'erp5.component.extension'
],
fromlist
=
[
'erp5.component.extension'
],
level
=
0
),
level
=
0
),
self
.
_function
)
self
.
_function
)
except
(
ImportError
,
AttributeError
):
except
(
ImportError
,
AttributeError
):
return
ExternalMethod__call__
(
self
,
*
args
,
**
kw
)
return
ExternalMethod__call__
(
self
,
*
args
,
**
kw
)
else
:
else
:
_v_f
=
getattr
(
self
,
'_v_f'
,
None
)
_v_f
=
getattr
(
self
,
'_v_f'
,
None
)
if
not
_v_f
or
f
is
not
_v_f
:
if
not
_v_f
or
f
is
not
_v_f
:
f
=
self
.
getFunction
(
f
=
f
)
f
=
self
.
getFunction
(
f
=
f
)
# From ExternalMethod.__call__
# From ExternalMethod.__call__
__traceback_info__
=
args
,
kw
,
self
.
_v_func_defaults
__traceback_info__
=
args
,
kw
,
self
.
_v_func_defaults
try
:
try
:
return
f
(
*
args
,
**
kw
)
return
f
(
*
args
,
**
kw
)
except
TypeError
,
v
:
except
TypeError
,
v
:
import
sys
import
sys
tb
=
sys
.
exc_info
()[
2
]
tb
=
sys
.
exc_info
()[
2
]
try
:
try
:
if
((
self
.
_v_func_code
.
co_argcount
-
if
((
self
.
_v_func_code
.
co_argcount
-
len
(
self
.
_v_func_defaults
or
())
-
1
==
len
(
args
))
and
len
(
self
.
_v_func_defaults
or
())
-
1
==
len
(
args
))
and
self
.
_v_func_code
.
co_varnames
[
0
]
==
'self'
):
self
.
_v_func_code
.
co_varnames
[
0
]
==
'self'
):
return
f
(
self
.
aq_parent
.
this
(),
*
args
,
**
kw
)
return
f
(
self
.
aq_parent
.
this
(),
*
args
,
**
kw
)
raise
TypeError
,
v
,
tb
raise
TypeError
,
v
,
tb
finally
:
finally
:
tb
=
None
tb
=
None
ExternalMethod
.
__call__
=
__call__
ExternalMethod
.
__call__
=
__call__
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