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
6651320c
Commit
6651320c
authored
Oct 09, 1997
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first cut, no testing
parent
d53be4db
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
143 additions
and
0 deletions
+143
-0
lib/python/Products/ExternalMethod/ExternalMethod.py
lib/python/Products/ExternalMethod/ExternalMethod.py
+73
-0
lib/python/Products/ExternalMethod/__init__.py
lib/python/Products/ExternalMethod/__init__.py
+38
-0
lib/python/Products/ExternalMethod/addForm.dtml
lib/python/Products/ExternalMethod/addForm.dtml
+32
-0
No files found.
lib/python/Products/ExternalMethod/ExternalMethod.py
0 → 100644
View file @
6651320c
"""External Method Product
This product provides support for external methods, which allow
domain-specific customization of web environments.
"""
from
Acquisition
import
Implicit
brain_dir
=
SOFTWARE_HOME
+
'/Extensions'
modules
=
{}
def
add
(
self
,
id
,
title
,
roles
,
external_name
,
REQUEST
=
None
):
"""Add an external method to a folder"""
names
=
split
(
external_name
,
'.'
)
module
,
function
=
join
(
names
[:
-
1
],
'.'
),
names
[
-
1
]
i
=
ExternalMethod
(
id
,
title
,
roles
,
module
,
function
)
self
.
_setObject
(
name
,
i
)
return
self
.
manage_main
(
self
,
REQUEST
)
class
ExternalMethod
:
"""An external method is a web-callable function that encapsulates
an external function."""
meta_type
=
'External Method'
def
__init__
(
self
,
id
=
''
,
title
=
''
,
roles
=
''
,
module
=
''
,
function
=
''
):
if
id
:
self
.
id
=
id
self
.
title
=
title
self
.
roles
=
roles
self
.
_module
=
module
self
.
_function
=
function
self
.
getFunction
()
self
.
_p_atime
=
1
def
getFunction
(
self
):
module
=
self
.
_module
try
:
m
=
modules
[
module
]
except
:
m
=
{}
exec
open
(
"%s/%s.py"
%
(
braindir
,
module
))
in
m
modules
[
module
]
=
m
f
=
m
[
self
.
_function
]
if
self
.
func_defaults
!=
f
.
func_defaults
:
self
.
func_defaults
=
f
.
func_defaults
func_code
=
FuncCode
(
f
)
if
func_code
!=
self
.
func_code
:
self
.
func_code
=
func_code
self
.
_v_f
=
f
return
f
def
__call__
(
self
,
*
args
):
try
:
f
=
self
.
_v_f
except
:
f
=
self
.
getFunction
()
return
apply
(
f
,
args
)
class
FuncCode
:
def
__init__
(
self
,
f
):
self
.
co_varnames
=
f
.
func_code
.
co_varnames
self
.
co_argcount
=
f
.
func_code
.
co_argcount
def
__cmp__
(
self
,
other
):
return
cmp
((
self
.
co_argcount
,
self
.
co_varnames
),
(
othr
.
co_argcount
,
othr
.
co_varnames
))
lib/python/Products/ExternalMethod/__init__.py
0 → 100644
View file @
6651320c
##############################################################################
#
# Copyright
#
# Copyright 1997 Digital Creations, L.C., 910 Princess Anne
# Street, Suite 300, Fredericksburg, Virginia 22401 U.S.A. All
# rights reserved.
#
##############################################################################
__doc__
=
'''External Method Product Initialization
$Id: __init__.py,v 1.1 1997/10/09 17:34:53 jim Exp $'''
__version__
=
'$Revision: 1.1 $'
[
11
:
-
2
]
import
ExternalMethod
__
.
meta_types
=
{
'name'
:
'External Method'
,
'action'
:
'manage_addExternalMethodForm'
},
__
.
methods
=
{
'manage_addExternalMethodForm'
:
ExternalMethod
.
addForm
,
'manage_addExternalMethod'
:
ExternalMethod
.
add
,
}
##############################################################################
#
# $Log: __init__.py,v $
# Revision 1.1 1997/10/09 17:34:53 jim
# first cut, no testing
#
# Revision 1.1 1997/07/25 18:14:28 jim
# initial
#
#
lib/python/Products/ExternalMethod/addForm.dtml
0 → 100644
View file @
6651320c
<HTML>
<HEAD>
<TITLE>New External Method</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B">
<FONT SIZE="+2" COLOR="#77003B">New External Method</FONT>
<FORM ACTION="manage_addExternalMethod" METHOD="POST">
<TABLE CELLSPACING="2">
<TR>
<TD ALIGN="LEFT" VALIGN="TOP"><B>Id</B></TD>
<TD ALIGN="LEFT" VALIGN="TOP"><INPUT TYPE="TEXT" NAME="id" SIZE="50"></TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP"><B>Title</B></TD>
<TD ALIGN="LEFT" VALIGN="TOP"><INPUT TYPE="TEXT" NAME="title" SIZE="50"></TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP"><B>External name:</B></TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<INPUT TYPE="TEXT" NAME="ExternalName" SIZE="50">
</TD>
</TR>
<TR>
<TD></TD>
<TD><BR><INPUT TYPE="SUBMIT" VALUE="Add External Method"></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
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