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
c056b482
Commit
c056b482
authored
Mar 09, 1998
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added new "package" support.
Also added new license support.
parent
a9ffc1b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 deletions
+22
-5
lib/python/Products/ExternalMethod/ExternalMethod.py
lib/python/Products/ExternalMethod/ExternalMethod.py
+22
-5
No files found.
lib/python/Products/ExternalMethod/ExternalMethod.py
View file @
c056b482
...
...
@@ -8,14 +8,16 @@ domain-specific customization of web environments.
from
Acquisition
import
Explicit
from
Globals
import
Persistent
,
HTMLFile
,
MessageDialog
import
OFS.SimpleItem
,
os
from
string
import
split
,
join
from
string
import
split
,
join
,
find
import
AccessControl.Role
braindir
=
SOFTWARE_HOME
+
'/Extensions'
modules
=
{}
manage_addExternalMethodForm
=
HTMLFile
(
'methodAdd'
,
globals
())
path_split
=
os
.
path
.
split
exists
=
os
.
path
.
exists
def
manage_addExternalMethod
(
self
,
id
,
title
,
module
,
function
,
REQUEST
=
None
):
"""Add an external method to a folder"""
i
=
ExternalMethod
(
id
,
title
,
module
,
function
)
...
...
@@ -73,11 +75,23 @@ class ExternalMethod(OFS.SimpleItem.Item, Persistent, Explicit,
try
:
m
=
modules
[
module
]
except
:
d
,
n
=
os
.
path
.
split
(
module
)
d
,
n
=
path_
split
(
module
)
if
d
:
raise
ValueError
,
(
'The file name, %s, should be a simple file name'
%
module
)
'The file name, %s, should be a simple file name'
%
module
)
m
=
{}
exec
open
(
"%s/%s.py"
%
(
braindir
,
module
))
in
m
d
=
find
(
n
,
'.'
)
if
d
>
0
:
d
,
n
=
n
[:
d
],
n
[
d
+
1
:]
n
=
(
"%s/lib/python/Products/%s/Extensions/%s.py"
%
(
SOFTWARE_HOME
,
d
,
n
))
__traceback_info__
=
n
,
module
if
exists
(
n
):
exec
open
(
n
)
in
m
else
:
exec
open
(
"%s/Extensions/%s.py"
%
(
SOFTWARE_HOME
,
module
))
in
m
else
:
exec
open
(
"%s/Extensions/%s.py"
%
(
SOFTWARE_HOME
,
module
))
in
m
modules
[
module
]
=
m
f
=
m
[
self
.
_function
]
...
...
@@ -129,3 +143,6 @@ class FuncCode:
def
__cmp__
(
self
,
other
):
return
cmp
((
self
.
co_argcount
,
self
.
co_varnames
),
(
other
.
co_argcount
,
other
.
co_varnames
))
import
__init__
__init__
.
need_license
=
1
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