Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
65951a87
Commit
65951a87
authored
Jun 11, 1999
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added auto-reloading of External Methods when in Development Mode.
parent
5778b4a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
lib/python/Products/ExternalMethod/ExternalMethod.py
lib/python/Products/ExternalMethod/ExternalMethod.py
+22
-6
No files found.
lib/python/Products/ExternalMethod/ExternalMethod.py
View file @
65951a87
...
...
@@ -88,14 +88,15 @@
This product provides support for external methods, which allow
domain-specific customization of web environments.
"""
__version__
=
'$Revision: 1.2
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
8
$'
[
11
:
-
2
]
from
Acquisition
import
Explicit
from
Globals
import
Persistent
,
HTMLFile
,
MessageDialog
,
HTML
import
OFS.SimpleItem
from
string
import
split
,
join
,
find
,
lower
import
AccessControl.Role
,
sys
,
regex
,
traceback
import
AccessControl.Role
,
sys
,
os
,
regex
,
traceback
from
OFS.SimpleItem
import
pretty_tb
from
App.Extensions
import
getObject
,
FuncCode
from
App.Extensions
import
getObject
,
getPath
,
FuncCode
from
Globals
import
DevelopmentMode
manage_addExternalMethodForm
=
HTMLFile
(
'methodAdd'
,
globals
())
...
...
@@ -208,6 +209,8 @@ class ExternalMethod(OFS.SimpleItem.Item, Persistent, Explicit,
return
f
def
__call__
(
self
,
*
args
,
**
kw
):
"""Call an ExternalMethod
...
...
@@ -226,9 +229,17 @@ class ExternalMethod(OFS.SimpleItem.Item, Persistent, Explicit,
In this case, the URL parent of the object is supplied as the
first argument.
"""
try
:
f
=
self
.
_v_f
except
:
f
=
self
.
getFunction
()
if
DevelopmentMode
:
ts
=
os
.
stat
(
self
.
filepath
())
if
not
hasattr
(
self
,
'_v_last_read'
)
or
\
(
ts
!=
self
.
_v_last_read
):
self
.
_v_f
=
self
.
getFunction
(
1
,
1
)
self
.
_v_last_read
=
ts
if
hasattr
(
self
,
'_v_f'
):
f
=
self
.
_v_f
else
:
f
=
self
.
getFunction
()
__traceback_info__
=
args
,
kw
,
self
.
func_defaults
...
...
@@ -251,3 +262,8 @@ class ExternalMethod(OFS.SimpleItem.Item, Persistent, Explicit,
def
function
(
self
):
return
self
.
_function
def
module
(
self
):
return
self
.
_module
def
filepath
(
self
):
if
not
hasattr
(
self
,
'_v_filepath'
):
self
.
_v_filepath
=
getPath
(
'Extensions'
,
self
.
_module
,
suffixes
=
(
''
,
'py'
,
'pyc'
,
'pyp'
))
return
self
.
_v_filepath
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