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
7badbb3c
Commit
7badbb3c
authored
Jul 25, 1996
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for __allow_groups__ method.
Made auto-generation of realms smarter about realm names.
parent
ab188030
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
10 deletions
+40
-10
lib/python/ZPublisher/Publish.py
lib/python/ZPublisher/Publish.py
+40
-10
No files found.
lib/python/ZPublisher/Publish.py
View file @
7badbb3c
...
@@ -456,7 +456,7 @@ Publishing a module using the ILU Requestor (future)
...
@@ -456,7 +456,7 @@ Publishing a module using the ILU Requestor (future)
o Configure the web server to call module_name@server_name with
o Configure the web server to call module_name@server_name with
the requestor.
the requestor.
$Id: Publish.py,v 1.1
1 1996/07/23 20:56:40
jfulton Exp $"""
$Id: Publish.py,v 1.1
2 1996/07/25 12:39:09
jfulton Exp $"""
#'
#'
# Copyright
# Copyright
#
#
...
@@ -509,6 +509,10 @@ $Id: Publish.py,v 1.11 1996/07/23 20:56:40 jfulton Exp $"""
...
@@ -509,6 +509,10 @@ $Id: Publish.py,v 1.11 1996/07/23 20:56:40 jfulton Exp $"""
# (540) 371-6909
# (540) 371-6909
#
#
# $Log: Publish.py,v $
# $Log: Publish.py,v $
# Revision 1.12 1996/07/25 12:39:09 jfulton
# Added support for __allow_groups__ method.
# Made auto-generation of realms smarter about realm names.
#
# Revision 1.11 1996/07/23 20:56:40 jfulton
# Revision 1.11 1996/07/23 20:56:40 jfulton
# Updated the documentation.
# Updated the documentation.
#
#
...
@@ -545,7 +549,7 @@ $Id: Publish.py,v 1.11 1996/07/23 20:56:40 jfulton Exp $"""
...
@@ -545,7 +549,7 @@ $Id: Publish.py,v 1.11 1996/07/23 20:56:40 jfulton Exp $"""
# Revision 1.5 1996/07/08 20:34:11 jfulton
# Revision 1.5 1996/07/08 20:34:11 jfulton
# Many changes, including:
# Many changes, including:
#
#
# - B
u
tter realm management
# - B
e
tter realm management
# - Automatic type conversion
# - Automatic type conversion
# - Improved documentation
# - Improved documentation
# - ...
# - ...
...
@@ -557,7 +561,7 @@ $Id: Publish.py,v 1.11 1996/07/23 20:56:40 jfulton Exp $"""
...
@@ -557,7 +561,7 @@ $Id: Publish.py,v 1.11 1996/07/23 20:56:40 jfulton Exp $"""
#
#
#
#
#
#
__version__
=
'$Revision: 1.1
1
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
2
$'
[
11
:
-
2
]
def
main
():
def
main
():
...
@@ -611,6 +615,12 @@ class ModulePublisher:
...
@@ -611,6 +615,12 @@ class ModulePublisher:
def
validate
(
self
,
groups
,
realm
=
None
):
def
validate
(
self
,
groups
,
realm
=
None
):
# Check whether groups is a collection, and, if not, try to
# call it:
try
:
len
(
groups
)
except
:
groups
=
groups
()
if
not
realm
:
if
not
realm
:
try
:
realm
=
self
.
realm
try
:
realm
=
self
.
realm
except
:
except
:
...
@@ -627,7 +637,7 @@ class ModulePublisher:
...
@@ -627,7 +637,7 @@ class ModulePublisher:
t
,
v
,
tb
=
sys
.
exc_type
,
sys
.
exc_value
,
sys
.
exc_traceback
t
,
v
,
tb
=
sys
.
exc_type
,
sys
.
exc_value
,
sys
.
exc_traceback
auth
,
v
=
v
auth
,
v
=
v
except
:
pass
except
:
pass
if
t
==
'Unauthorized'
:
if
t
==
'Unauthorized'
:
self
.
response
[
'WWW-authenticate'
]
=
auth
self
.
response
[
'WWW-authenticate'
]
=
auth
raise
'Unauthorized'
,
v
raise
'Unauthorized'
,
v
self
.
forbiddenError
()
self
.
forbiddenError
()
...
@@ -639,6 +649,8 @@ class ModulePublisher:
...
@@ -639,6 +649,8 @@ class ModulePublisher:
self
.
module_name
=
module_name
self
.
module_name
=
module_name
response
=
self
.
response
response
=
self
.
response
response
.
setBase
(
self
.
base
)
response
.
setBase
(
self
.
base
)
default_realm_name
=
"%s.%s"
%
(
self
.
module_name
,
self
.
request
.
SERVER_NAME
)
realm_name
=
default_realm_name
dict
=
imported_modules
dict
=
imported_modules
try
:
try
:
...
@@ -691,6 +703,7 @@ class ModulePublisher:
...
@@ -691,6 +703,7 @@ class ModulePublisher:
while
path
:
while
path
:
entry_name
,
path
=
path
[
0
],
path
[
1
:]
entry_name
,
path
=
path
[
0
],
path
[
1
:]
default_realm_name
=
"%s.%s"
%
(
entry_name
,
default_realm_name
)
if
entry_name
:
if
entry_name
:
try
:
try
:
subobject
=
getattr
(
object
,
entry_name
)
subobject
=
getattr
(
object
,
entry_name
)
...
@@ -703,9 +716,13 @@ class ModulePublisher:
...
@@ -703,9 +716,13 @@ class ModulePublisher:
except
:
except
:
try
:
doc
=
getattr
(
object
,
entry_name
+
'__doc__'
)
try
:
doc
=
getattr
(
object
,
entry_name
+
'__doc__'
)
except
:
doc
=
None
except
:
doc
=
None
try
:
realm
=
subobject
.
__realm__
try
:
realm
=
subobject
.
__realm__
realm_name
=
default_realm_name
except
:
except
:
try
:
realm
=
getattr
(
object
,
entry_name
+
'__realm__'
)
try
:
realm
=
getattr
(
object
,
entry_name
+
'__realm__'
)
realm_name
=
default_realm_name
except
:
pass
except
:
pass
except
AttributeError
:
except
AttributeError
:
try
:
try
:
...
@@ -718,9 +735,13 @@ class ModulePublisher:
...
@@ -718,9 +735,13 @@ class ModulePublisher:
except
:
except
:
try
:
doc
=
object
[
entry_name
+
'__doc__'
]
try
:
doc
=
object
[
entry_name
+
'__doc__'
]
except
:
doc
=
None
except
:
doc
=
None
try
:
realm
=
subobject
.
__realm__
try
:
realm
=
subobject
.
__realm__
realm_name
=
default_realm_name
except
:
except
:
try
:
realm
=
object
[
entry_name
+
'__realm__'
]
try
:
realm
=
object
[
entry_name
+
'__realm__'
]
realm_name
=
default_realm_name
except
:
pass
except
:
pass
except
(
TypeError
,
AttributeError
):
except
(
TypeError
,
AttributeError
):
if
not
path
and
entry_name
==
'help'
and
doc
:
if
not
path
and
entry_name
==
'help'
and
doc
:
...
@@ -750,7 +771,16 @@ class ModulePublisher:
...
@@ -750,7 +771,16 @@ class ModulePublisher:
# Do authorization checks
# Do authorization checks
if
groups
:
self
.
validate
(
groups
,
realm
)
if
groups
:
try
:
if
realm
.
name
is
None
:
realm
.
name
=
realm_name
except
:
try
:
len
(
realm
)
realm
=
Realm
(
realm_name
,
realm
)
except
:
pass
self
.
validate
(
groups
,
realm
)
object_as_function
=
object
object_as_function
=
object
if
type
(
object_as_function
)
is
types
.
ClassType
:
if
type
(
object_as_function
)
is
types
.
ClassType
:
...
@@ -787,7 +817,7 @@ class ModulePublisher:
...
@@ -787,7 +817,7 @@ class ModulePublisher:
if
name_index
<
nrequired
:
if
name_index
<
nrequired
:
self
.
badRequestError
(
argument_name
)
self
.
badRequestError
(
argument_name
)
# Attempt to start a transaction:
# Attempt to start a transaction:
try
:
try
:
transaction
=
get_transaction
()
transaction
=
get_transaction
()
...
...
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