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
eefc1383
Commit
eefc1383
authored
Feb 14, 2001
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged 1.47.18.1.4.1.
parent
f535cae5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
201 additions
and
192 deletions
+201
-192
z2.py
z2.py
+201
-192
No files found.
z2.py
View file @
eefc1383
...
...
@@ -547,71 +547,72 @@ if Zpid and not READ_ONLY:
zdaemon
.
run
(
sys
.
argv
,
os
.
path
.
join
(
CLIENT_HOME
,
Zpid
))
# Import logging support
import
zLOG
import
ZLogger
try
:
# Import logging support
import
zLOG
import
ZLogger
if
READ_ONLY
:
if
READ_ONLY
:
zLOG
.
_stupid_dest
=
sys
.
stderr
else
:
else
:
zLOG
.
log_write
=
ZLogger
.
ZLogger
.
log_write
if
DETAILED_LOG_FILE
:
if
DETAILED_LOG_FILE
:
from
ZServer
import
DebugLogger
logfile
=
os
.
path
.
join
(
CLIENT_HOME
,
DETAILED_LOG_FILE
)
DebugLogger
.
log
=
DebugLogger
.
DebugLogger
(
logfile
).
log
# Import Zope (or Main)
exec
"import "
+
MODULE
in
{}
# Import Zope (or Main)
exec
"import "
+
MODULE
in
{}
# Location of the ZServer log file. This file logs all ZServer activity.
# You may wish to create different logs for different servers. See
# medusa/logger.py for more information.
if
not
os
.
path
.
isabs
(
LOG_FILE
):
# Location of the ZServer log file. This file logs all ZServer activity.
# You may wish to create different logs for different servers. See
# medusa/logger.py for more information.
if
not
os
.
path
.
isabs
(
LOG_FILE
):
LOG_PATH
=
os
.
path
.
join
(
CLIENT_HOME
,
LOG_FILE
)
else
:
else
:
LOG_PATH
=
LOG_FILE
# Location of the ZServer pid file. When ZServer starts up it will write
# its PID to this file.
PID_FILE
=
os
.
path
.
join
(
CLIENT_HOME
,
'Z2.pid'
)
# Location of the ZServer pid file. When ZServer starts up it will write
# its PID to this file.
PID_FILE
=
os
.
path
.
join
(
CLIENT_HOME
,
'Z2.pid'
)
# import ZServer stuff
# import ZServer stuff
# First, we need to increase the number of threads
if
MODULE
==
'Zope'
:
# First, we need to increase the number of threads
if
MODULE
==
'Zope'
:
from
ZServer
import
setNumberOfThreads
setNumberOfThreads
(
NUMBER_OF_THREADS
)
from
ZServer
import
resolver
,
logger
,
asyncore
from
ZServer
import
resolver
,
logger
,
asyncore
from
ZServer
import
zhttp_server
,
zhttp_handler
from
ZServer.WebDAVSrcHandler
import
WebDAVSrcHandler
from
ZServer
import
PCGIServer
,
FTPServer
,
FCGIServer
from
ZServer
import
zhttp_server
,
zhttp_handler
from
ZServer.WebDAVSrcHandler
import
WebDAVSrcHandler
from
ZServer
import
PCGIServer
,
FTPServer
,
FCGIServer
from
ZServer
import
secure_monitor_server
from
ZServer
import
secure_monitor_server
## ZServer startup
##
## ZServer startup
##
# Resolver and Logger, used by other servers
if
DNS_IP
:
# Resolver and Logger, used by other servers
if
DNS_IP
:
rs
=
resolver
.
caching_resolver
(
DNS_IP
)
else
:
else
:
rs
=
None
if
READ_ONLY
:
if
READ_ONLY
:
lg
=
logger
.
file_logger
(
'-'
)
# log to stdout
elif
os
.
environ
.
has_key
(
'ZSYSLOG'
):
elif
os
.
environ
.
has_key
(
'ZSYSLOG'
):
lg
=
logger
.
syslog_logger
(
os
.
environ
[
'ZSYSLOG'
])
elif
os
.
environ
.
has_key
(
'ZSYSLOG_SERVER'
):
elif
os
.
environ
.
has_key
(
'ZSYSLOG_SERVER'
):
lg
=
logger
.
syslog_logger
(
string
.
split
(
os
.
environ
[
'ZSYSLOG_SERVER'
],
':'
))
else
:
else
:
lg
=
logger
.
file_logger
(
LOG_PATH
)
# HTTP Server
if
HTTP_PORT
:
# HTTP Server
if
HTTP_PORT
:
if
type
(
HTTP_PORT
)
is
type
(
0
):
HTTP_PORT
=
((
IP_ADDRESS
,
HTTP_PORT
),)
for
address
,
port
in
HTTP_PORT
:
hs
=
zhttp_server
(
...
...
@@ -633,9 +634,9 @@ if HTTP_PORT:
zh
=
zhttp_handler
(
MODULE
,
''
,
HTTP_ENV
)
hs
.
install_handler
(
zh
)
# WebDAV source Server (runs HTTP, but munges request to return
# 'manage_FTPget').
if
WEBDAV_SOURCE_PORT
:
# WebDAV source Server (runs HTTP, but munges request to return
# 'manage_FTPget').
if
WEBDAV_SOURCE_PORT
:
if
type
(
WEBDAV_SOURCE_PORT
)
is
type
(
0
):
WEBDAV_SOURCE_PORT
=
((
IP_ADDRESS
,
WEBDAV_SOURCE_PORT
),)
for
address
,
port
in
WEBDAV_SOURCE_PORT
:
...
...
@@ -658,8 +659,8 @@ if WEBDAV_SOURCE_PORT:
zh
=
WebDAVSrcHandler
(
MODULE
,
''
,
HTTP_ENV
)
hs
.
install_handler
(
zh
)
# FTP Server
if
FTP_PORT
:
# FTP Server
if
FTP_PORT
:
if
type
(
FTP_PORT
)
is
type
(
0
):
FTP_PORT
=
((
IP_ADDRESS
,
FTP_PORT
),)
for
address
,
port
in
FTP_PORT
:
FTPServer
(
...
...
@@ -669,8 +670,8 @@ if FTP_PORT:
resolver
=
rs
,
logger_object
=
lg
)
# PCGI Server
if
PCGI_FILE
and
not
READ_ONLY
:
# PCGI Server
if
PCGI_FILE
and
not
READ_ONLY
:
PCGI_FILE
=
os
.
path
.
join
(
here
,
PCGI_FILE
)
if
os
.
path
.
exists
(
PCGI_FILE
):
zpcgi
=
PCGIServer
(
...
...
@@ -681,8 +682,8 @@ if PCGI_FILE and not READ_ONLY:
logger_object
=
lg
)
# FastCGI Server
if
FCGI_PORT
and
not
READ_ONLY
:
# FastCGI Server
if
FCGI_PORT
and
not
READ_ONLY
:
fcgiPort
=
None
fcgiPath
=
None
try
:
...
...
@@ -697,8 +698,8 @@ if FCGI_PORT and not READ_ONLY:
logger_object
=
lg
)
# Monitor Server
if
MONITOR_PORT
:
# Monitor Server
if
MONITOR_PORT
:
from
AccessControl.User
import
emergency_user
if
not
hasattr
(
emergency_user
,
'__null_user__'
):
pw
=
emergency_user
.
_getPassword
()
...
...
@@ -715,10 +716,10 @@ if MONITOR_PORT:
hostname
=
address
,
port
=
port
)
# Try to set uid to "-u" -provided uid.
# Try to set gid to "-u" user's primary group.
# This will only work if this script is run by root.
try
:
# Try to set uid to "-u" -provided uid.
# Try to set gid to "-u" user's primary group.
# This will only work if this script is run by root.
try
:
import
pwd
try
:
try
:
UID
=
string
.
atoi
(
UID
)
...
...
@@ -743,13 +744,13 @@ try:
pass
except
KeyError
:
zLOG
.
LOG
(
"z2"
,
zLOG
.
ERROR
,
(
"can't find UID %s"
%
UID
))
except
:
except
:
pass
# if it hasn't failed at this point, create a .pid file.
if
not
READ_ONLY
:
# if it hasn't failed at this point, create a .pid file.
if
not
READ_ONLY
:
pf
=
open
(
PID_FILE
,
'w'
)
pid
=
str
(
os
.
getpid
())
try
:
pid
=
str
(
os
.
getppid
())
+
' '
+
pid
...
...
@@ -757,6 +758,14 @@ if not READ_ONLY:
pf
.
write
(
pid
)
pf
.
close
()
except
:
# Log startup exception and tell zdaemon not to restart us.
try
:
zLOG
.
LOG
(
"z2"
,
zLOG
.
PANIC
,
"Startup exception"
,
error
=
sys
.
exc_info
())
except
:
pass
sys
.
exit
(
0
)
# Start Medusa, Ye Hass!
sys
.
ZServerExitCode
=
0
asyncore
.
loop
()
...
...
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