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
Hide 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 @@
##############################################################################
__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 $"""
__version__
=
'$Revision: 1.16
6
$'
[
11
:
-
2
]
$Id: Publish.py,v 1.16
7 2004/04/25 21:26:15 fdrake
Exp $"""
__version__
=
'$Revision: 1.16
7
$'
[
11
:
-
2
]
import
sys
,
os
from
Response
import
Response
...
...
@@ -47,6 +47,17 @@ def missing_name(name, request):
def
dont_publish_class
(
klass
,
request
):
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
,
# Optimize:
call_object
=
call_object
,
...
...
@@ -224,10 +235,8 @@ def get_module_info(module_name, modules={},
# Let the app specify a realm
if
hasattr
(
module
,
'__bobo_realm__'
):
realm
=
module
.
__bobo_realm__
elif
os
.
environ
.
has_key
(
'Z_REALM'
):
realm
=
os
.
environ
[
'Z_REALM'
]
elif
os
.
environ
.
has_key
(
'BOBO_REALM'
):
realm
=
os
.
environ
[
'BOBO_REALM'
]
elif
_default_realm
is
not
None
:
realm
=
_default_realm
else
:
realm
=
module_name
...
...
@@ -236,15 +245,7 @@ def get_module_info(module_name, modules={},
if
hasattr
(
module
,
'__bobo_debug_mode__'
):
debug_mode
=
not
not
module
.
__bobo_debug_mode__
else
:
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
debug_mode
=
_default_debug_mode
bobo_before
=
getattr
(
module
,
"__bobo_before__"
,
None
)
bobo_after
=
getattr
(
module
,
"__bobo_after__"
,
None
)
...
...
lib/python/Zope/Startup/__init__.py
View file @
96f4172a
...
...
@@ -60,8 +60,11 @@ class ZopeStarter:
"""
def
__init__
(
self
):
self
.
event_logger
=
logging
.
getLogger
()
# set up our initial logging environment (log everything to stderr
# if we're not in debug mode).
# We log events to the root logger, which is backed by a
# "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
(
"%(asctime)s %(levelname)s %(name)s %(message)s"
,
"%Y-%m-%d %H:%M:%S"
)
...
...
@@ -78,14 +81,10 @@ class ZopeStarter:
self
.
cfg
=
cfg
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
.
setupLocale
()
self
.
setupSecurityOptions
()
self
.
setupPublisher
()
# Start ZServer servers before we drop privileges so we can bind to
# "low" ports:
self
.
setupZServerThreads
()
...
...
@@ -127,6 +126,13 @@ class ZopeStarter:
def
error
(
self
,
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
):
import
AccessControl
AccessControl
.
setImplementation
(
...
...
lib/python/Zope/Startup/handlers.py
View file @
96f4172a
...
...
@@ -16,12 +16,6 @@ def _setenv(name, value):
else
:
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
):
import
locale
locale
.
setlocale
(
locale
.
LC_ALL
,
value
)
...
...
@@ -95,10 +89,6 @@ def publisher_profile_file(value):
install_profiling
(
value
)
return
value
def
http_realm
(
value
):
value
is
not
None
and
_setenv
(
'Z_REALM'
,
value
)
return
value
def
max_listen_sockets
(
value
):
import
ZServer
ZServer
.
CONNECTION_LIMIT
=
value
...
...
lib/python/Zope/Startup/zopeschema.xml
View file @
96f4172a
...
...
@@ -328,8 +328,7 @@
<metadefault>
$clienthome/Z2.lock
</metadefault>
</key>
<key
name=
"debug-mode"
datatype=
"boolean"
default=
"on"
handler=
"debug_mode"
>
<key
name=
"debug-mode"
datatype=
"boolean"
default=
"on"
>
<description>
A switch which controls several aspects of Zope operation useful for
developing under Zope. When debug mode is on:
...
...
@@ -486,7 +485,7 @@
</description>
</key>
<key
name=
"http-realm"
default=
"Zope"
handler=
"http_realm"
>
<key
name=
"http-realm"
default=
"Zope"
>
<description>
The HTTP "Realm" header value sent by this Zope instance. This value
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