Skip to main content

Wrappers, which make working with ZEO little bit nicer.

Project description


Wrappers, which make working with ZEO little bit nicer.

By default, you have to do a lot of stuff, like create connection to database, maintain it, synchronize it (or running asyncore loop), handle reconnects and so on. Classes defined in this project makes all this work for you at the background.


This module defines three classes:

  • ZEOWrapperPrototype
  • ZEOConfWrapper
  • ZEOWrapper


ZEOWrapperPrototype contains methods and shared attributes, which may be used by derived classes.

You can pretty much ignore this class, unless you want to make your own connector.


ZEOConfWrapper may be used to create connection to ZEO from XML configuration file.

Lets say you have file /tests/data/zeo_client.conf:

  server localhost:60985

You can now create the ZEOConfWrapper object:

from zeo_connector import ZEOConfWrapper

db_obj = ZEOConfWrapper(
    project_key="Some project key",

and save the data to the database:

import transaction

with transaction.manager:
    db_obj["data"] = "some data"

String "some data" is now saved under db._connection.root()[project_key]["data"] path.


ZEOWrapper doesn’t use XML configuration file, but direct server/port specification:

from zeo_connector import ZEOWrapper

different_db_obj = ZEOWrapper(
    project_key="Some project key",

So you can retreive the data you stored into the database:

import transaction

with transaction.manager:
    print different_db_obj["data"]

Running the ZEO server

The examples expects, that the ZEO server is running. To run the ZEO, look at the help page of the runzeo script which is part of the ZEO bundle. This script requires commandline or XML configuration.

You can generate the configuration files using provided script, which is part of the zeo_connector_defaults <> package:

$ --help
usage: [-h] [-s SERVER] [-p PORT] [-C] [-S]

This program will create the default ZEO XML configuration files.

positional arguments:
  PATH                  Path to the database on the server (used in server
                        configuration only.

optional arguments:
  -h, --help            show this help message and exit
  -s SERVER, --server SERVER
                        Server url. Default: localhost
  -p PORT, --port PORT  Port of the server. Default: 60985
  -C, --only-client     Create only CLIENT configuration.
  -S, --only-server     Create only SERVER configuration

For example:

$ /tmp

will create zeo.conf file with following content:

  address localhost:60985

  path /tmp/storage.fs

  level INFO
    path /tmp/zeo.log
    format %(asctime)s %(message)s

and zeo_client.conf containing:

  server localhost:60985

You can change the ports and address of the server using --server or --port arguments.

To run the ZEO with the server configuration file, run the following command:

runzeo -C zeo.conf

To run the client, you may use ZEOConfWrapper, as was show above:

from zeo_connector import ZEOConfWrapper

db_obj = ZEOConfWrapper(
    project_key="Some project key",


Module is hosted at PYPI, and can be easily installed using PIP:

sudo pip install zeo_connector

Source code

Project is released under the MIT license. Source code can be found at GitHub:


You can run the tests using provided script, which can be found in the root of the project.

If you have any trouble, just add --pdb switch at the end of your command like this: ./ --pdb. This will drop you to PDB shell.


This script expects that package pytest is installed. In case you don’t have it yet, it can be easily installed using following command:

pip install --user pytest

or for all users:

sudo pip install pytest


$ ./
============================= test session starts ==============================
platform linux2 -- Python 2.7.6 -- py-1.4.30 -- pytest-2.7.2
rootdir: /home/bystrousak/Plocha/Dropbox/c0d3z/python/libs/zeo_connector, inifile:
plugins: cov
collected 7 items

tests/ .......

=========================== 7 passed in 7.08 seconds ===========================




  • Pinned older version of ZEO.


  • Cleanup of metadata files.

0.4.0 - 0.4.5

  • Added @retry_and_reset decorator for all internal dict-methods calls.
  • Project key is now optional, so this object may be used to access the root of the database.
  • Implemented .pack().
  • Added @transaction_manager.
  • Added examples/ and tests.
  • Added @wraps(fn) to decorators.
  • Added requirement for zope.interface.
  • Attempt to solve



  • Added standard dict methods, like .__contains__(), .__delitem__(), .__iter__() and so on.


  • Project created.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for zeo_connector, version 0.4.8
Filename, size File type Python version Upload date Hashes
Filename, size zeo_connector-0.4.8.tar.gz (8.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page