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
96f4172a
Commit
96f4172a
authored
Apr 25, 2004
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove all uses of environment variables for configuring ZPublisher.
parent
efc1aafc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
35 deletions
+31
-35
lib/python/ZPublisher/Publish.py
lib/python/ZPublisher/Publish.py
+16
-15
lib/python/Zope/Startup/__init__.py
lib/python/Zope/Startup/__init__.py
+13
-7
lib/python/Zope/Startup/handlers.py
lib/python/Zope/Startup/handlers.py
+0
-10
lib/python/Zope/Startup/zopeschema.xml
lib/python/Zope/Startup/zopeschema.xml
+2
-3
No files found.
lib/python/ZPublisher/Publish.py
View file @
96f4172a
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
##############################################################################
##############################################################################
__doc__
=
"""Python Object Publisher -- Publish Python objects on web servers
__doc__
=
"""Python Object Publisher -- Publish Python objects on web servers
$Id: Publish.py,v 1.16
6 2003/11/18 13:17:17 tseaver
Exp $"""
$Id: Publish.py,v 1.16
7 2004/04/25 21:26:15 fdrake
Exp $"""
__version__
=
'$Revision: 1.16
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.16
7
$'
[
11
:
-
2
]
import
sys
,
os
import
sys
,
os
from
Response
import
Response
from
Response
import
Response
...
@@ -47,6 +47,17 @@ def missing_name(name, request):
...
@@ -47,6 +47,17 @@ def missing_name(name, request):
def
dont_publish_class
(
klass
,
request
):
def
dont_publish_class
(
klass
,
request
):
request
.
response
.
forbiddenError
(
"class %s"
%
klass
.
__name__
)
request
.
response
.
forbiddenError
(
"class %s"
%
klass
.
__name__
)
_default_debug_mode
=
False
_default_realm
=
None
def
set_default_debug_mode
(
debug_mode
):
global
_default_debug_mode
_default_debug_mode
=
debug_mode
def
set_default_authentication_realm
(
realm
):
global
_default_realm
_default_realm
=
realm
def
publish
(
request
,
module_name
,
after_list
,
debug
=
0
,
def
publish
(
request
,
module_name
,
after_list
,
debug
=
0
,
# Optimize:
# Optimize:
call_object
=
call_object
,
call_object
=
call_object
,
...
@@ -224,10 +235,8 @@ def get_module_info(module_name, modules={},
...
@@ -224,10 +235,8 @@ def get_module_info(module_name, modules={},
# Let the app specify a realm
# Let the app specify a realm
if
hasattr
(
module
,
'__bobo_realm__'
):
if
hasattr
(
module
,
'__bobo_realm__'
):
realm
=
module
.
__bobo_realm__
realm
=
module
.
__bobo_realm__
elif
os
.
environ
.
has_key
(
'Z_REALM'
):
elif
_default_realm
is
not
None
:
realm
=
os
.
environ
[
'Z_REALM'
]
realm
=
_default_realm
elif
os
.
environ
.
has_key
(
'BOBO_REALM'
):
realm
=
os
.
environ
[
'BOBO_REALM'
]
else
:
else
:
realm
=
module_name
realm
=
module_name
...
@@ -236,15 +245,7 @@ def get_module_info(module_name, modules={},
...
@@ -236,15 +245,7 @@ def get_module_info(module_name, modules={},
if
hasattr
(
module
,
'__bobo_debug_mode__'
):
if
hasattr
(
module
,
'__bobo_debug_mode__'
):
debug_mode
=
not
not
module
.
__bobo_debug_mode__
debug_mode
=
not
not
module
.
__bobo_debug_mode__
else
:
else
:
debug_mode
=
_default_debug_mode
z1
=
os
.
environ
.
get
(
'Z_DEBUG_MODE'
,
''
)
z2
=
os
.
environ
.
get
(
'BOBO_DEBUG_MODE'
,
''
)
if
z1
.
lower
()
in
(
'yes'
,
'y'
)
or
z1
.
isdigit
():
debug_mode
=
1
elif
z2
.
lower
()
in
(
'yes'
,
'y'
)
or
z2
.
isdigit
():
debug_mode
=
1
bobo_before
=
getattr
(
module
,
"__bobo_before__"
,
None
)
bobo_before
=
getattr
(
module
,
"__bobo_before__"
,
None
)
bobo_after
=
getattr
(
module
,
"__bobo_after__"
,
None
)
bobo_after
=
getattr
(
module
,
"__bobo_after__"
,
None
)
...
...
lib/python/Zope/Startup/__init__.py
View file @
96f4172a
...
@@ -60,8 +60,11 @@ class ZopeStarter:
...
@@ -60,8 +60,11 @@ class ZopeStarter:
"""
"""
def
__init__
(
self
):
def
__init__
(
self
):
self
.
event_logger
=
logging
.
getLogger
()
self
.
event_logger
=
logging
.
getLogger
()
# set up our initial logging environment (log everything to stderr
# We log events to the root logger, which is backed by a
# if we're not in debug mode).
# "StartupHandler" log handler. The "StartupHandler" buffers
# log messages. When the "real" loggers are set up, we flush
# accumulated messages in StartupHandler's buffers to the real
# logger.
formatter
=
logging
.
Formatter
(
formatter
=
logging
.
Formatter
(
"%(asctime)s %(levelname)s %(name)s %(message)s"
,
"%(asctime)s %(levelname)s %(name)s %(message)s"
,
"%Y-%m-%d %H:%M:%S"
)
"%Y-%m-%d %H:%M:%S"
)
...
@@ -78,14 +81,10 @@ class ZopeStarter:
...
@@ -78,14 +81,10 @@ class ZopeStarter:
self
.
cfg
=
cfg
self
.
cfg
=
cfg
def
prepare
(
self
):
def
prepare
(
self
):
# we log events to the root logger, which is backed by a
# "StartupHandler" log handler. The "StartupHandler" outputs to
# stderr but also buffers log messages. When the "real" loggers
# are set up, we flush accumulated messages in StartupHandler's
# buffers to the real logger.
self
.
setupInitialLogging
()
self
.
setupInitialLogging
()
self
.
setupLocale
()
self
.
setupLocale
()
self
.
setupSecurityOptions
()
self
.
setupSecurityOptions
()
self
.
setupPublisher
()
# Start ZServer servers before we drop privileges so we can bind to
# Start ZServer servers before we drop privileges so we can bind to
# "low" ports:
# "low" ports:
self
.
setupZServerThreads
()
self
.
setupZServerThreads
()
...
@@ -127,6 +126,13 @@ class ZopeStarter:
...
@@ -127,6 +126,13 @@ class ZopeStarter:
def
error
(
self
,
msg
):
def
error
(
self
,
msg
):
logger
.
error
(
msg
)
logger
.
error
(
msg
)
def
setupPublisher
(
self
):
import
Globals
import
ZPublisher.Publish
Globals
.
DevelopmentMode
=
self
.
cfg
.
debug_mode
ZPublisher
.
Publish
.
set_default_debug_mode
(
self
.
cfg
.
debug_mode
)
ZPublisher
.
Publish
.
set_default_realm
(
self
.
cfg
.
http_realm
)
def
setupSecurityOptions
(
self
):
def
setupSecurityOptions
(
self
):
import
AccessControl
import
AccessControl
AccessControl
.
setImplementation
(
AccessControl
.
setImplementation
(
...
...
lib/python/Zope/Startup/handlers.py
View file @
96f4172a
...
@@ -16,12 +16,6 @@ def _setenv(name, value):
...
@@ -16,12 +16,6 @@ def _setenv(name, value):
else
:
else
:
os
.
environ
[
name
]
=
`value`
os
.
environ
[
name
]
=
`value`
def
debug_mode
(
value
):
value
and
_setenv
(
'Z_DEBUG_MODE'
,
'1'
)
import
Globals
Globals
.
DevelopmentMode
=
not
not
value
return
value
def
locale
(
value
):
def
locale
(
value
):
import
locale
import
locale
locale
.
setlocale
(
locale
.
LC_ALL
,
value
)
locale
.
setlocale
(
locale
.
LC_ALL
,
value
)
...
@@ -95,10 +89,6 @@ def publisher_profile_file(value):
...
@@ -95,10 +89,6 @@ def publisher_profile_file(value):
install_profiling
(
value
)
install_profiling
(
value
)
return
value
return
value
def
http_realm
(
value
):
value
is
not
None
and
_setenv
(
'Z_REALM'
,
value
)
return
value
def
max_listen_sockets
(
value
):
def
max_listen_sockets
(
value
):
import
ZServer
import
ZServer
ZServer
.
CONNECTION_LIMIT
=
value
ZServer
.
CONNECTION_LIMIT
=
value
...
...
lib/python/Zope/Startup/zopeschema.xml
View file @
96f4172a
...
@@ -328,8 +328,7 @@
...
@@ -328,8 +328,7 @@
<metadefault>
$clienthome/Z2.lock
</metadefault>
<metadefault>
$clienthome/Z2.lock
</metadefault>
</key>
</key>
<key
name=
"debug-mode"
datatype=
"boolean"
default=
"on"
<key
name=
"debug-mode"
datatype=
"boolean"
default=
"on"
>
handler=
"debug_mode"
>
<description>
<description>
A switch which controls several aspects of Zope operation useful for
A switch which controls several aspects of Zope operation useful for
developing under Zope. When debug mode is on:
developing under Zope. When debug mode is on:
...
@@ -486,7 +485,7 @@
...
@@ -486,7 +485,7 @@
</description>
</description>
</key>
</key>
<key
name=
"http-realm"
default=
"Zope"
handler=
"http_realm"
>
<key
name=
"http-realm"
default=
"Zope"
>
<description>
<description>
The HTTP "Realm" header value sent by this Zope instance. This value
The HTTP "Realm" header value sent by this Zope instance. This value
often shows up in basic authentication dialogs.
often shows up in basic authentication dialogs.
...
...
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