/usr/share/pyshared/zope/app/server/servertype.py is in python-zope.app.server 3.6.0-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | ##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Server Type
"""
from zope.interface import Interface, implements
class IServerType(Interface):
"""Server type utility.
This is a pure read-only interface, since the values are set through
a ZCML directive and we shouldn't be able to change them.
"""
def create(name, task_dispatcher, db, port=None, verbose=None, ip=None):
"""Create the server knowing the port, task dispatcher and the ZODB.
Returns the new server.
"""
class ServerType(object):
implements(IServerType)
def __init__(self, factory, requestFactory, logFactory,
defaultPort, defaultVerbose, defaultIP=''):
self._factory = factory
self._requestFactory = requestFactory
self._logFactory = logFactory
self._defaultPort = defaultPort
self._defaultVerbose = defaultVerbose
self._defaultIP = defaultIP
def create(self, name, task_dispatcher, db, port=None,
verbose=None, ip=None):
'See IServerType'
request_factory = self._requestFactory(db)
if port is None:
port = self._defaultPort
if ip is None:
ip = self._defaultIP
if verbose is None:
verbose = self._defaultVerbose
return self._factory(request_factory, name, ip, port,
task_dispatcher=task_dispatcher,
verbose=verbose,
hit_log=self._logFactory(),
)
|