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
4c346558
Commit
4c346558
authored
Feb 10, 2003
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various cleanups for clarity.
parent
65f6c4f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
lib/python/App/Extensions.py
lib/python/App/Extensions.py
+21
-21
No files found.
lib/python/App/Extensions.py
View file @
4c346558
...
...
@@ -14,8 +14,8 @@ __doc__='''Standard routines for handling extensions.
Extensions currently include external methods and pluggable brains.
$Id: Extensions.py,v 1.
19 2002/08/14 21:31:40 mj
Exp $'''
__version__
=
'$Revision: 1.
19
$'
[
11
:
-
2
]
$Id: Extensions.py,v 1.
20 2003/02/10 18:26:03 fdrake
Exp $'''
__version__
=
'$Revision: 1.
20
$'
[
11
:
-
2
]
import
os
,
zlib
,
rotor
,
imp
import
Products
...
...
@@ -102,16 +102,15 @@ def getObject(module, name, reload=0,
# update the cache, then one will have simply worked a little
# harder than need be. So, in this case, we won't incur
# the expense of a lock.
if
modules
.
has_key
(
module
):
old
=
modules
[
module
]
if
old
.
has_key
(
name
)
and
not
reload
:
return
old
[
name
]
else
:
old
=
None
old
=
modules
.
get
(
module
)
if
old
is
not
None
and
name
in
old
and
not
reload
:
return
old
[
name
]
if
module
[
-
3
:]
==
'.py'
:
p
=
module
[:
-
3
]
elif
module
[
-
4
:]
==
'.pyp'
:
p
=
module
[:
-
4
]
elif
module
[
-
4
:]
==
'.pyc'
:
p
=
module
[:
-
4
]
else
:
p
=
module
base
,
ext
=
os
.
path
.
splitext
(
module
)
if
ext
in
(
'py'
,
'pyp'
,
'pyc'
):
p
=
base
else
:
p
=
module
p
=
getPath
(
'Extensions'
,
p
,
suffixes
=
(
''
,
'py'
,
'pyp'
,
'pyc'
))
if
p
is
None
:
raise
"Module Error"
,
(
...
...
@@ -120,14 +119,15 @@ def getObject(module, name, reload=0,
__traceback_info__
=
p
,
module
if
p
[
-
4
:]
==
'.pyc'
:
base
,
ext
=
os
.
path
.
splitext
(
p
)
if
ext
==
'.pyc'
:
file
=
open
(
p
,
'rb'
)
binmod
=
imp
.
load_compiled
(
'Extension'
,
p
,
file
)
file
.
close
()
m
=
binmod
.
__dict__
elif
p
[
-
4
:]
==
'.pyp'
:
prod_id
=
module
.
split
(
'.'
)[
0
]
elif
ext
==
'.pyp'
:
prod_id
=
module
.
split
(
'.'
,
1
)[
0
]
data
=
zlib
.
decompress
(
rotor
.
newrotor
(
prod_id
+
' shshsh'
).
decrypt
(
open
(
p
,
'rb'
).
read
())
)
...
...
@@ -143,18 +143,18 @@ def getObject(module, name, reload=0,
m
=
{}
exec
execsrc
in
m
try
:
r
=
m
[
name
]
if
old
is
not
None
:
old
.
update
(
m
)
else
:
modules
[
module
]
=
m
try
:
return
m
[
name
]
except
KeyError
:
raise
'Invalid Object Name'
,
(
"The specified object, <em>%s</em>, was not found in module, "
"<em>%s</em>."
%
(
name
,
module
))
if
old
:
for
k
,
v
in
m
.
items
():
old
[
k
]
=
v
modules
[
module
]
=
m
return
r
class
NoBrains
:
pass
def
getBrain
(
module
,
class_name
,
reload
=
0
):
...
...
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