Commit b60449d8 authored by Tres Seaver's avatar Tres Seaver

Merge pull request #34 from gocept/icemac-WindowsError-2.13

Don't bail on WindowsError which is not existing on non-windows systems.
parents 34da9ede c7e7bf80
...@@ -8,7 +8,8 @@ http://docs.zope.org/zope2/ ...@@ -8,7 +8,8 @@ http://docs.zope.org/zope2/
2.13.24 (unreleased) 2.13.24 (unreleased)
-------------------- --------------------
- TBD - Issue #34: Fix ``NameError`` exception for ``WindowsError`` which could
happen on non-windows systems.
2.13.23 (2015-06-29) 2.13.23 (2015-06-29)
-------------------- --------------------
......
...@@ -27,6 +27,12 @@ from ZConfig.components.logger import loghandler ...@@ -27,6 +27,12 @@ from ZConfig.components.logger import loghandler
from zope.event import notify from zope.event import notify
from zope.processlifetime import ProcessStarting from zope.processlifetime import ProcessStarting
try:
IO_ERRORS = (IOError, WindowsError)
except NameError:
IO_ERRORS = (IOError,)
logger = logging.getLogger("Zope") logger = logging.getLogger("Zope")
started = False started = False
...@@ -91,7 +97,7 @@ class ZopeStarter: ...@@ -91,7 +97,7 @@ class ZopeStarter:
# emit a "ready" message in order to prevent the kinds of emails # emit a "ready" message in order to prevent the kinds of emails
# to the Zope maillist in which people claim that Zope has "frozen" # to the Zope maillist in which people claim that Zope has "frozen"
# after it has emitted ZServer messages. # after it has emitted ZServer messages.
logger.info('Ready to handle requests') logger.info('Ready to handle requests')
self.sendEvents() self.sendEvents()
...@@ -193,7 +199,7 @@ class ZopeStarter: ...@@ -193,7 +199,7 @@ class ZopeStarter:
# This one has the delayed listening feature # This one has the delayed listening feature
if not server.fast_listen: if not server.fast_listen:
server.fast_listen = True server.fast_listen = True
server.listen(1024) # same value as defined in medusa.http_server.py server.listen(1024) # same value as defined in medusa.http_server.py
def setupServers(self): def setupServers(self):
socket_err = ( socket_err = (
...@@ -283,7 +289,7 @@ class ZopeStarter: ...@@ -283,7 +289,7 @@ class ZopeStarter:
lock_file(self.lockfile) lock_file(self.lockfile)
self.lockfile.write(str(os.getpid())) self.lockfile.write(str(os.getpid()))
self.lockfile.flush() self.lockfile.flush()
except (IOError, WindowsError): except IO_ERRORS:
pass pass
def makePidFile(self): def makePidFile(self):
...@@ -295,7 +301,7 @@ class ZopeStarter: ...@@ -295,7 +301,7 @@ class ZopeStarter:
f = open(self.cfg.pid_filename, 'w') f = open(self.cfg.pid_filename, 'w')
f.write(str(os.getpid())) f.write(str(os.getpid()))
f.close() f.close()
except (IOError, WindowsError): except IO_ERRORS:
pass pass
def unlinkPidFile(self): def unlinkPidFile(self):
...@@ -409,7 +415,7 @@ def dropPrivileges(cfg): ...@@ -409,7 +415,7 @@ def dropPrivileges(cfg):
os.setuid(uid) os.setuid(uid)
logger.info('Set effective user to "%s"' % effective_user) logger.info('Set effective user to "%s"' % effective_user)
return 1 # for unit testing purposes return 1 # for unit testing purposes
# DM 2004-11-24: added # DM 2004-11-24: added
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment