Skip to content.

plope

Personal tools
You are here: Home » Members » chrism's Home » What's New in Zope 2.7
 
 

What's New in Zope 2.7

Zope 2.7 has been in development for over a year now, but is soon to be released in its final version. This document will attempt to enumerate the most important new features of Zope 2.7 vs. Zope 2.6. This is not a completely comprehensive list of changes (for that see the CHANGES.txt that ships with Zope), but where possible, I've attempted to call out and explain some of the most important new features of Zope 2.7.

New Features

  • Supports (actually requires) Python 2.3.2 or better

    Zope 2.7 requires Python 2.3.2 or better to run. All the features of Python 2.3.X are supported within Zope, except Zope 2.7 lacks the ability to persist instances created from new-style classes to the ZODB. This will be a prominent feature of Zope 2.8.

  • Installation from source

    Older versions of Zope were installed from source by invoking "python wo_pcgi.py". This would set up a SOFTWARE_HOME-driven installation inside the source tree itself.

    Zope 2.7+ is installed from source in a more UNIX-y manner:

         tar xvzf Zope-2.7.X.tgz
         cd Zope-2.7.X
         ./configure
         make
         make install
    

    The default installation location for the ZOPE_HOME is /opt/Zope27. This can be overridden by passing configure a --prefix option (e.g. "--prefix=/home/chrism/opt/Zope27").

    The "configure" command can also be run from within a separate build directory to preserve a "pristine" source tree, ala:

         tar xvzf Zope-2.7.X.tgz
         mkdir zopebuild
         cd zopebuild
         ../..Zope-2.7.X/configure
         make; make install
    

    The configure script accepts a number of options:

         configure [--help] [--quiet] [--with-python=path] [--prefix=path]
                   [--build-base=path] [--ignore-largefile] [--ignore-zlib]
                   [--optimize]
    
          Creates a Makefile suitable for building and installing Zope
    
          Options:
           --help              shows usage and quits
           --quiet             suppress nonessential output
           --with-python       specify a path to a Python interpreter to use
           --prefix            specify an installation path for binary data
           --build-base        specify a temporary path for build files
           --ignore-largefile  ignore large file support warnings
           --ignore-expat      ignore warnings about expat/pyexpat
           --ignore-zlib       ignore warnings about zlib
           --optimize          optimize compiled Python bytecode
           --no-compile        Dont compile Python bytecode
    
          Given no options, configure will search your PATH for a suitable
          Python interpreter and will use '/opt/Zope-2.7' as a prefix.
    

  • Binary installation support

    As usual, a binary executable installer is supplied for Windows 2K/XP/NT/9X by Zope Corporation. The Windows binary setup now uses Innosetup (as opposed to the WISE installer), and now supports Windows services on a per-INSTANCE_HOME-basis on Windows NT/XP/2K. Zope binaries will no longer be shipped by Zope Corporation for Linux or Solaris: although 3rd parties may provide binary packages (RPM, deb, pkg, et. al.). The source installation is the ZC-recommended installation method for all UNIX versions.

  • INSTANCE_HOME setup now the default for normal installation

    A script named "mkzopeinstance.py" can now be run after "make install" to create an INSTANCE_HOME for your Zope, allowing you to run more than one Zope instance against one Zope SOFTWARE_HOME. This is now the recommended way to configure Zope. An example of an invocation of this script is as follows:

         athlon:~/software/27Branch$ bin/mkzopeinstance.py
         Please choose a directory in which you'd like to install
         Zope "instance home" files such as database files, configuration
         files, etc.
    
         Directory: ~/tmp/inst
         Please choose a username and password for the initial user.
         These will be the credentials you use to initially manage
         your new Zope instance.
    
         Username: admin
         Password:
         Verify password:
         athlon:~/software/27Branch$ cd ~/tmp/inst/
         athlon:~/tmp/inst$ ls
         bin  etc  Extensions  import  inituser  log  Products  README.txt  var
    

  • Configuration-file driven configuration

    Zope 2.6 and prior were configured with a combination of environment variables and command-line options to the Zope "start" or "z2.py" scripts. Zope 2.7's configuration options are managed via a configuration file instead (environment variables are not respected). Once you've created an instance home, you can edit the configuration file in $INSTANCE_HOME/etc/zope.conf. It contains explanatory text for each configurable option.

    Most config file directives are straight mappings from their command-line-option or environment-variable counterparts from Zope 2.6. However, there are new features in Zope 2.7 which were not in prior versions that you can control via the configuration file.

    path
    add a path to Zope's PYTHONPATH after startup
    products
    specify additional paths which contain Zope Product packages.
    environment
    set environment variables via the config file
    lock-filename
    Zope 2.7 writes a lock file when it starts, specify the path to the lockfile here.
    mime-types
    specify paths to additional mime-type mapping files
    warnfilter
    configure Python warning filters that are active when Zope is started.
    zodb_db
    specify a set of ZODB databases to use (DBTab integration)
  • ZEO included

    ZEO is now included with Zope 2.7. To make use of it, use the "mkzeoinstance.py" script in Zope's "bin" directory:

         athlon:~/software/27Branch$ bin/mkzeoinstance.py
         Usage: mkzeoinstance.py home [port]
         athlon:~/software/27Branch$ bin/mkzeoinstance.py /tmp/zeo 9999
         Created directory /tmp/zeo
         Created directory /tmp/zeo/etc
         Created directory /tmp/zeo/var
         Created directory /tmp/zeo/log
         Created directory /tmp/zeo/bin
         Wrote file /tmp/zeo/etc/zeo.conf
         Wrote file /tmp/zeo/bin/zeoctl
         Changed mode for /tmp/zeo/bin/zeoctl to 755
         Wrote file /tmp/zeo/bin/runzeo
         Changed mode for /tmp/zeo/bin/runzeo to 755
         athlon:~/software/27Branch$
    

    By doing so, you've created a ZEO server home. You can run your ZEO server by invoking "$ZEO_HOME/bin/zeoctl start" and changing your Zope config file to point the main database at the ZEO server. This only works under UNIX at the moment.

  • DBTab integration

    DBTab was an add-on product by Shane Hathaway for Zope 2.6 that allowed you to configure "mounted" databases in Zope. "Mounted" databases are separate ZODB databases that appear in the ZMI as normal folders, though they store their data in a completely different ZODB database.

    Zope 2.7 incorporates DBTab, but replaces DBTab's Windows-ini-style configuration file with directives in the main zope configuration file.

    An example of using a filestorage as the "main" database via the configuration file:

         <zodb_db main>
             # Main FileStorage database
             mount-point /
             <filestorage>
               path $INSTANCE/var/Data.fs
             </filestorage>
         </zodb_db>
    

    An example of using a MappingStorage as a "mounted" database via the configuration file. Note the "mount-point" argument, which specifies the path at which the mounted database should appear inside the "main" database:

         <zodb_db amappingstorage>
             # Main FileStorage database
             mount-point /afolder
             <mappingstorage>
                name mystorage
             </mappingstorage>
         </zodb_db>
    

    An example of using a ZEO ClientStorage as a "mounted" database via the configuration file:

         <zodb_db main>
           mount-point /zeomount
           <zeoclient>
             server localhost:8100
             storage 1
             name zeostorage
             var $INSTANCE/var
           </zeoclient>
         </zodb_db>
    

    Any number of mounted databases may be configured within the Zope configuration file. At least one zodb_db directive must exist in the configuration file which specifies the "main" Zope database at mount-point "/". All other zodb_db definitions are optional.

  • Enhanced logging configuration

    Logging configuration is enhanced in Zope 2.7+. Owing to Python 2.3's "logging" package, you can specify multiple simultaneous "log handlers" for each of Zope's three main logs (the eventlog, the access log and the trace log). This means, for instance, that you can send the event log to both STDOUT and a file, the access log to a file, and the trace log to syslog by changing the configuration file like so:

          <eventlog>
            level all
            <logfile>
              path $INSTANCE/log/event.log
              level info
            </logfile>
            <logfile>
              path STDOUT
            </logfile>
          </eventlog>
    
          <logger access>
            level WARN
            <logfile>
              path $INSTANCE/log/Z2.log
            </logfile>
          </logger>
    
          <logger trace>
            level WARN
            <syslog-handler>
              host localhost
              port 514
            </syslog-handler>
          </logger>
    

    Additional log handlers besides file-based and syslog-based include win32-eventlog, http-handler (POST), and email-notifier. See the zope.conf file for more info and other twiddleable logging options.

  • runzope and zopectl (UNIX-only)

    Zope 2.6 and prior were typically started via a "start" script that was written in the course of the execution of "wo_pcgi.py". Zope 2.7+ doesn't write a "start" script, but can be run in two ways on UNIX:

    $INSTANCE_HOME/bin/runzope
    start Zope and don't detach from the terminal
    $INSTANCE_HOME/bin/zopectl {start | stop | restart}
    run Zope as a daemon process (detach from the terminal).

    The "zopectl" script is also interactive and provides other useful features. Invoking the zopectl script without options provides an interactive command-line shell:

         athlon:~/software/27Branch$ bin/zopectl
         program: /home/chrism/software/27Branch/bin/runzope
         daemon manager not running
         zopectl> ?
    
         Documented commands (type help <topic>):
         ========================================
         EOF      fg          kill       quit     run    start   wait
         adduser  foreground  logreopen  reload   shell  status
         debug    help        logtail    restart  show   stop
    
         zopectl> start
         daemon process started, pid=24338
         zopectl> logtail
         ------
         2003-12-21T17:50:49 INFO(0) Zope Ready to handle requests
         ------
         2003-12-21T17:50:51 INFO(0) Z2 Caught signal SIGINT
         ------
         2003-12-21T17:50:51 INFO(0) Z2 Shutting down
         ------
         2003-12-21T21:49:04 INFO(0) Zope Ready to handle requests
    

    "zopectl" can also be used to add a user with the "Manager" role to Zope's ZODB database:

         zopectl adduser ausername apassword
    

    "zopectl debug" allows you to interactvely inspect the ZODB:

         athlon:~/software/27Branch$ bin/zopectl debug
         Starting debugger (the name "app" is bound to the top-level Zope object)
         >>> app.objectIds()
         ['acl_users', 'Control_Panel', 'temp_folder', 'session_data_manager',
          'browser_id_manager', 'error_log', 'standard_html_header',
           'standard_template.pt', 'standard_error_message', 'index_html',
           'standard_html_footer']
         >>>
    

    "zopectl run" allows you to run a Python script against your Zope instance with the name "app" bound to the top-level Zope object. For instance, the script named "obids.py" with the following content:

         print app.objectIds()
    

    ..can be run like so:

         athlon:~/software/27Branch$ bin/zopectl run obids.py
         ['acl_users', 'Control_Panel', 'temp_folder', 'session_data_manager',
          'browser_id_manager', 'error_log', 'standard_html_header',
          'standard_template.pt', 'standard_error_message', 'index_html',
          'standard_html_footer']
    

    On Windows, a runzope.bat script is provided that performs the same duties as the "runzope" script under UNIX. Daemonizing is provided by the Windows service manager under Windows NT/2K/XP. The other features of zopectl are not supported under Windows at this time.

  • Better effective user support on UNIX

    Zope 2.6's "effective user" support (support for dropping privileges to another user when Zope was started as the root user) was essentially broken. Zope 2.7 does only as much is as necessary as the root user (binding to "low" ports, essentially) and then writes its logfiles and database files and so on as the less privileged user. The effective user (and group) may be changed via the Zope configuration file.

  • Zope Tutorial updated

    The Zope interactive tutorial has been updated to use ZPT instead of DTML in its examples.

  • Examples no longer imported by default

    The Examples folder must be imported explicitly now. The QuickStart page (the main page that shows up when you visit Zope in a browser for the first time, sans "manage") contains instructions on how to import the examples.

  • reStructuredText included

    Andreas Jung has provided a Zope interface to the reStructuredText package.

  • context/here normalized in Page Templates

    The name "context" can now be used as a synonym for "here" in page templates. This brings ZPT and PythonScripts into parity as to how they refer to their current context.

  • OrderedFolder support

    A new built-in meta_type, "OrderedFolder" is in the core. This type provides a folder class which presents a UI which allows people to reorder its contents.

Backwards Incompatibilities

  • Scripts which call "app = Zope.app()"

    If you're a developer who has written a script to inspect or change Zope's ZODB using the "import Zope; app = Zope.app()", you will need to amend these scripts to perform an additional step. Namely, before you can call "app = Zope.app()", you need to let Zope know which configuration it should use by calling the "Zope.configure" function with a config file name:

          import Zope
          Zope.configure('/path/to/zope.conf')
          app = Zope.app()
    

Created by chrism
Last modified 2003-12-21 10:18 PM

Zope Startup Linux

How should I use zopectl to startup the zope server during a machine restart.... ?

forgotten things

international DateTime support, RestructuredDocument added

Python 2.3.3

Anthony Baxter says:

""" One correction - I suspect that Python 2.3.3 will become the minimum required version, because of the weakref/gc issues. """

Useful, reST version covering 2.8+ into CVS?

This is a useful, concise document that explains and summarizes many of the things that a new or upgrading Zope user will want to know about. Something like it should be included in releases. It would be nice to see a reStructuredText version of this document added to the Zope CVS HEAD that reflects ongoing changes in current HEAD configuration procedures.

zopectl debug - with running zope?

Perhaps a clarification in the ' "zopectl debug" allows you to interactvely inspect the ZODB:' section; Does this work with zope already running, or only when stopped?

If not, it would be useful to see the section on ZEO setup slightly expanded to explain a local ZEO+local Zope setup for debugging with a still-running Zope.

I'd still like to see this config as a make target or mkinstance option, but step-by-step instructions would help someone perhaps trying their first zope debugging to get a good debugging setup running quickly.

.configure?

Tried::

import Zope
Zope.configure('/path/to/zope.conf')
app = Zope.app()

But my Zope (2.7b3) has no .configure method. Am I missing something obvious? Only in a specific CVS branch?

setting Zope Version in source build

After I built Zope 2.7.0 from source the ZMI Control_Panel showed the version as "unreleased version". After copying the lib/python/version.txt file from the source/build directory into the corresponding place under the installation (ZOPE_HOME) directory and restarting ZServer, the correct version number then appeared.