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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
569c3097
Commit
569c3097
authored
Jan 18, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch ExternalMethod Zope class for erp5.component.extension.
parent
832970fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
0 deletions
+54
-0
product/ERP5Type/ZopePatch.py
product/ERP5Type/ZopePatch.py
+1
-0
product/ERP5Type/patches/ExternalMethod.py
product/ERP5Type/patches/ExternalMethod.py
+53
-0
No files found.
product/ERP5Type/ZopePatch.py
View file @
569c3097
...
...
@@ -69,6 +69,7 @@ from Products.ERP5Type.patches import ZODBConnection
from
Products.ERP5Type.patches
import
ZopePageTemplateUtils
from
Products.ERP5Type.patches
import
OFSHistory
from
Products.ERP5Type.patches
import
OFSItem
from
Products.ERP5Type.patches
import
ExternalMethod
# These symbols are required for backward compatibility
from
Products.ERP5Type.patches.PropertyManager
import
ERP5PropertyManager
...
...
product/ERP5Type/patches/ExternalMethod.py
0 → 100644
View file @
569c3097
from
Products.ExternalMethod.ExternalMethod
import
ExternalMethod
from
App.Extensions
import
FuncCode
,
getObject
def
getFunction
(
self
,
reload
=
False
,
f
=
None
):
if
f
is
None
:
import
erp5.component.extension
try
:
f
=
getattr
(
getattr
(
erp5
.
component
.
extension
,
self
.
_module
),
self
.
_function
)
except
AttributeError
:
f
=
getObject
(
self
.
_module
,
self
.
_function
,
reload
)
# From ExternalMethod.getFunction
ff
=
getattr
(
f
,
'im_func'
,
f
)
self
.
_v_func_defaults
=
ff
.
func_defaults
self
.
_v_func_code
=
FuncCode
(
ff
,
f
is
not
ff
)
self
.
_v_f
=
f
return
f
ExternalMethod
.
getFunction
=
getFunction
ExternalMethod__call__
=
ExternalMethod
.
__call__
def
__call__
(
self
,
*
args
,
**
kw
):
import
erp5.component.extension
try
:
f
=
getattr
(
getattr
(
erp5
.
component
.
extension
,
self
.
_module
),
self
.
_function
)
except
AttributeError
:
return
ExternalMethod__call__
(
self
,
*
args
,
**
kw
)
else
:
_v_f
=
getattr
(
self
,
'_v_f'
,
None
)
if
not
_v_f
or
f
is
not
_v_f
:
f
=
self
.
getFunction
(
f
=
f
)
# From ExternalMethod.__call__
__traceback_info__
=
args
,
kw
,
self
.
_v_func_defaults
try
:
return
f
(
*
args
,
**
kw
)
except
TypeError
,
v
:
import
sys
tb
=
sys
.
exc_info
()[
2
]
try
:
if
((
self
.
_v_func_code
.
co_argcount
-
len
(
self
.
_v_func_defaults
or
())
-
1
==
len
(
args
))
and
self
.
_v_func_code
.
co_varnames
[
0
]
==
'self'
):
return
f
(
self
.
aq_parent
.
this
(),
*
args
,
**
kw
)
raise
TypeError
,
v
,
tb
finally
:
tb
=
None
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