Skip to content

Commit

Permalink
Merge branch 'master' into document_site_error_log
Browse files Browse the repository at this point in the history
  • Loading branch information
jugmac00 committed Sep 10, 2019
2 parents 6677acb + 4aadecc commit e0c6376
Show file tree
Hide file tree
Showing 44 changed files with 39 additions and 949 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Expand Up @@ -17,3 +17,7 @@ Backwards incompatible changes
- Drop support for Python 2.7 aka Zope 5 cannot be run on Python 2 any more.
If you are still running on Python 2.7 upgrade to the latest Zope 4 version
first, migrate to Python 3 and than switch to Zope 5.
(`#692 <https://github.com/zopefoundation/Zope/issues/692>`_)

- Drop support for running Zope with ZServer as it is Python 2 only.
(`#592 <https://github.com/zopefoundation/Zope/issues/592>`_)
13 changes: 0 additions & 13 deletions buildout.cfg
Expand Up @@ -9,10 +9,8 @@ installed = .installed.cfg
parts =
test
scripts
zserverscripts
zopescripts
alltests
zservertests
ztktests
allpy
sphinx
Expand Down Expand Up @@ -43,11 +41,6 @@ eggs =
wheel
zest.releaser

[zserverscripts]
recipe = zc.recipe.egg
eggs = ZServer


[zopescripts]
recipe = zc.recipe.egg
interpreter = zopepy
Expand Down Expand Up @@ -79,12 +72,6 @@ eggs =
Record


[zservertests]
<= alltests
script = zservertests
eggs += ZServer


[ztktests]
recipe = zc.recipe.testrunner
script = ztktests
Expand Down
1 change: 0 additions & 1 deletion constraints.txt
Expand Up @@ -21,7 +21,6 @@ WebTest==2.0.33
ZConfig==3.5.0
ZEO==5.2.1
ZODB==5.5.1
ZServer==4.0.2 ; python_version < '3.0'
Zope2==4.0
five.globalrequest==99.1
five.localsitemanager==3.2.2
Expand Down
24 changes: 0 additions & 24 deletions docs/INSTALL.rst
Expand Up @@ -155,22 +155,6 @@ include the WSGI server software egg in the ``eggs`` specification:
http-address = 8080
wsgi = /path/to/zope.ini
On Python 2 you can also forego the use of WSGI and create an old-fashioned
ZServer-based installation by pulling in the ``ZServer`` egg and setting
``wsgi = off`` explicitly:

.. code-block:: ini
[zopeinstance]
recipe = plone.recipe.zope2instance
eggs =
Products.TemporaryFolder
ZServer
user = admin:adminpassword
http-address = 8080
wsgi = off
Installing Zope with ``pip``
----------------------------
Installing the Zope software using ``pip`` involves the following
Expand Down Expand Up @@ -205,14 +189,6 @@ more than are listed in the ``install_requires`` section of ``setup.py``):
$ bin/pip install \
-r https://zopefoundation.github.io/Zope/releases/4.1/requirements-full.txt
If you are on Python 2 and want to use ZServer instead of WSGI , you'll have to
install that package seperately using the version spec in constraints.txt

.. code-block:: console
$ bin/pip install \
-c https://zopefoundation.github.io/Zope/releases/4.1/constraints.txt \
ZServer
Building the documentation with ``Sphinx``
------------------------------------------
Expand Down
15 changes: 4 additions & 11 deletions docs/operation.rst
Expand Up @@ -17,13 +17,6 @@ Whichever method you used to install Zope and create a server instance (see
Creating a Zope instance
------------------------

.. attention::

The following steps describe how to install a WSGI based Zope instance.
If you want/have to use ZServer instead of WSGI (Python 2 only!) follow
the documentation `Creating a Zope instance for Zope 2.13`_, as it has not
changed since that version.

Once you've installed Zope, you will need to create an "instance
home". This is a directory that contains configuration and data for a
Zope server process. The instance home is created using the
Expand Down Expand Up @@ -88,7 +81,7 @@ After making any changes to the configuration file, you need to restart any
running Zope server for the affected instance before changes are in effect.

For a full description of the supported sections and directives for
``zope.conf``, refer to the :ref:`configuration reference section
``zope.conf``, refer to the :ref:`configuration reference section
<configuration_reference>`.


Expand Down Expand Up @@ -156,7 +149,7 @@ works with the ``runwsgi`` script. It assumes your buildout is located at
KillMode=control-group
TimeoutStartSec=10
TimeoutStopSec=10
[Install]
WantedBy=multi-user.target
Expand Down Expand Up @@ -270,7 +263,7 @@ user account your Zope instance runs under is ``zope``:
[Unit]
Description=Zope client zopeinstance
After=network.target
[Service]
Type=forking
User=zope
Expand All @@ -281,7 +274,7 @@ user account your Zope instance runs under is ``zope``:
KillMode=control-group
TimeoutStartSec=10
TimeoutStopSec=10
[Install]
WantedBy=multi-user.target
Expand Down
24 changes: 11 additions & 13 deletions docs/wsgi.rst
Expand Up @@ -35,7 +35,7 @@ Building a Zope instance with WSGI support
Zope ships with several helper scripts to set up a default WSGI-enabled
environment. The document :doc:`operation` walks you through using
``mkwsgiinstance`` for a default configuration that you can use in conjunction
with the ``runwsgi`` script to start a Zope instance.
with the ``runwsgi`` script to start a Zope instance.

The buildout extension ``plone.recipe.zope2instance`` expands on that and
adds a script wrapper for convenient starting and stopping as well as a host
Expand All @@ -45,9 +45,8 @@ of other functions. Take a look at `their PyPI page listing all options

Logging configuration
---------------------
When running Zope under the old ZServer, logging configurations were built in.
Now they are explicit and part of the WSGI configuration ``.ini`` file. The
default configurations created by ``mkwsgiinstance`` and
The logging configurations are part of the WSGI configuration ``.ini`` file.
The default configurations created by ``mkwsgiinstance`` and
``plone.recipe.zope2instance`` are suitable for most applications.

Keep in mind that different WSGI servers have different logging behaviors. Some
Expand All @@ -63,7 +62,7 @@ capture and log all errors propagating from your application.
``Paste`` egg in your buildout's ``eggs`` specification.
You can use the generated default WSGI configuration's logging sections as a
starting point for changes. The `Python Logging Cookbook
starting point for changes. The `Python Logging Cookbook
<https://docs.python.org/3/howto/logging-cookbook.html>`_ has a great selection
of topics for advanced configurations.

Expand All @@ -81,11 +80,10 @@ Things to watch out for
~~~~~~~~~~~~~~~~~~~~~~~
The ZODB uses connection pooling where a working thread grabs a connection
from the pool to serve content and then releases it when the work is done.
The default size of this connection pool is 7. The advice from ``ZServer``
days to choose a number of application threads that stays safely below that
number of ZODB connections is still valid. ``ZServer`` used 4 threads by
default, so if the WSGI server lets you configure the number of threads 4 is
still a safe choice.
The default size of this connection pool is 7. You should choose a number of
application threads that stays safely below that number of ZODB connections.
If the WSGI server lets you configure the number of threads, 4 is a safe
choice.

Another recommendation from Zope 2 is still valid as well: If you have a choice
between less Zope instances with a higher number of threads each, or more
Expand Down Expand Up @@ -201,7 +199,7 @@ werkzeug
++++++++
`werkzeug <https://palletsprojects.com/p/werkzeug/>`_ is a WSGI library that
contains not just a WSGI server, but also a powerful debugger. It can
easily integrate wth Zope using a shim package called `dataflake.wsgi.werkzeug
easily integrate wth Zope using a shim package called `dataflake.wsgi.werkzeug
<https://dataflakewsgiwerkzeug.readthedocs.io/>`_. See the `Using this package`
section for how to integrate `werkzeug` using Zope's own ``runwsgi`` script and
how to create a suitable WSGI configuration.
Expand Down Expand Up @@ -307,8 +305,8 @@ section will pull in the correct dependencies:
Debugging Zope applications under WSGI
--------------------------------------
You can debug a WSGI-based Zope application the same way you have debugged
ZServer-based installations in the past. In addition, you can now take
You can debug a WSGI-based Zope application by adding a statement to activate
the debugger. In addition, you can take
advantage of WSGI middleware or debugging facilities built into the chosen
WSGI server.

Expand Down
14 changes: 2 additions & 12 deletions docs/zdgbook/ObjectPublishing.rst
Expand Up @@ -2,16 +2,6 @@
Object Publishing
#################

.. note::

Previously, this document contained information about access by
**FTP** and **WebDAV**. As those functionalities were provided by the
now removed **ZServer**, the related information also has been removed.

Please directly refer to the **ZServer** package for further
information.


Introduction
============

Expand Down Expand Up @@ -204,7 +194,7 @@ will try in order to find the next object:
2. ``a.next``

3. ``a["next"]``


Publishing Methods
------------------
Expand Down Expand Up @@ -853,7 +843,7 @@ You can also provide default values for record elements with the
``default`` converter. For example::

<input type="hidden"
name="pizza.toppings:record:list:default"
name="pizza.toppings:record:list:default"
value="All">
<select multiple name="pizza.toppings:record:list:ignore_empty">
<option>Cheese</option>
Expand Down
18 changes: 9 additions & 9 deletions docs/zdgbook/TestingAndDebugging.rst
Expand Up @@ -148,16 +148,16 @@ debugger::
... blah blah...

</BODY></HTML>
>>>
>>>

If you look closely, you will see that the content returned is
*exactly* what is returned when you call your root level object
through HTTP, including all the HTTP headers.

Keep in mind that calling Zope this way does NOT involve a web
server. No ports are opened, the 'ZServer' code is not even
imported. In fact, this is just an interpreter front end to the same
application code the ZServer *does* call.
server. No ports are opened.
In fact, this is just an interpreter front end to the same
application code the WSGI server *does* call.

Interactive Debugging
~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -209,7 +209,7 @@ one new argument to the call to 'Zope'::
algorithm.
* Then type c<cr> to jump to published object call.
> <string>(0)?()
pdb>
pdb>

Here, you call Zope from the interpreter, just like before, but there
are two differences. First, you call the 'postnews' method with an
Expand Down Expand Up @@ -255,7 +255,7 @@ easier method). For example::
pdb> import Products
pdb> b Products.ZopeNews.News.News.postnews
Breakpoint 5 at C:\Program Files\WebSite\lib\python\Products\ZopeNews\News.py:42
pdb>
pdb>

First, you import 'Products'. Since your module is a Zope product,
it can be found in the 'Products' package. Next, you set a new
Expand Down Expand Up @@ -315,7 +315,7 @@ final argument is 'request'. This is the request object and will
eventually be transformed in to the DTML usable object 'REQUEST'. Now
continue, your breakpoint is next::

pdb> c
pdb> c
> C:\Program Files\WebSite\lib\python\Products\ZopeNews\News.py(42)postnews()
-> def postnews(self, N)

Expand Down Expand Up @@ -638,8 +638,8 @@ example::

def testWebRequest(self):
ZPublisher.Zope('/a/url/representing/a/method?with=a&couple=arguments',
u='username:password',
s=1,
u='username:password',
s=1,
e={'some':'environment', 'variable':'settings'})

If the 's' argument is passed to 'ZPublisher.Zope' then no output
Expand Down
1 change: 0 additions & 1 deletion sources.cfg
Expand Up @@ -28,7 +28,6 @@ Products.Sessions = git ${remotes:github}/Products.Sessions pushurl=${remotes:gi
Products.TemporaryFolder = git ${remotes:github}/Products.TemporaryFolder pushurl=${remotes:github_push}/Products.TemporaryFolder
Products.SiteErrorLog = git ${remotes:github}/Products.SiteErrorLog pushurl=${remotes:github_push}/Products.SiteErrorLog
Record = git ${remotes:github}/Record pushurl=${remotes:github_push}/Record
ZServer = git ${remotes:github}/ZServer pushurl=${remotes:github_push}/ZServer

# ZTK
zope.annotation = git ${remotes:github}/zope.annotation
Expand Down
9 changes: 0 additions & 9 deletions src/App/ImageFile.py
Expand Up @@ -21,7 +21,6 @@
from AccessControl.class_init import InitializeClass
from AccessControl.SecurityInfo import ClassSecurityInfo
from Acquisition import Explicit
from App import bbb
from App.Common import package_home
from App.Common import rfc1123_date
from App.config import getConfiguration
Expand Down Expand Up @@ -121,14 +120,6 @@ def index_html(self, REQUEST, RESPONSE):
RESPONSE.setHeader('Content-Length', str(self.size).replace('L', ''))
return filestream_iterator(self.path, mode='rb')

if bbb.HAS_ZSERVER:
@security.public
def HEAD(self, REQUEST, RESPONSE):
""" """
RESPONSE.setHeader('Content-Type', self.content_type)
RESPONSE.setHeader('Last-Modified', self.lmh)
return ''

def __len__(self):
# This is bogus and needed because of the way Python tests truth.
return 1
Expand Down
38 changes: 1 addition & 37 deletions src/App/ZApplication.py
Expand Up @@ -42,32 +42,8 @@ def __init__(self, db, name, klass=None):
def __getattr__(self, name):
return getattr(self._klass, name)

def __bobo_traverse__(self, REQUEST=None, name=None):
# This is only called by ZServer.ZPublisher.Publish,
# as the app in the module_info is used directly.

conn = self._db.open()

# arrange for the connection to be closed when the request goes away
cleanup = Cleanup(conn)
REQUEST._hold(cleanup)

conn.setDebugInfo(REQUEST.environ, REQUEST.other)

v = conn.root()[self._name]

if name is not None:
if hasattr(v, '__bobo_traverse__'):
return v.__bobo_traverse__(REQUEST, name)

if hasattr(v, name):
return getattr(v, name)
return v[name]

return v

def __call__(self, connection=None):
# This is only called by ZPublisher.WSGIPublisher,
# This is called by ZPublisher.WSGIPublisher,
# as load_app calls the app object present in the module_info.

db = self._db
Expand All @@ -77,15 +53,3 @@ def __call__(self, connection=None):
connection = db.open(connection)

return connection.root()[self._name]


class Cleanup(object):
def __init__(self, jar):
self._jar = jar

def __del__(self):
if self._jar.transaction_manager._txn is not None:
# Only abort a transaction, if one exists. Otherwise the
# abort creates a new transaction just to abort it.
self._jar.transaction_manager.abort()
self._jar.close()

0 comments on commit e0c6376

Please sign in to comment.