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