Table of Contents

  1. Introduction
  2. Setup
  3. Example

Zope Howto

Introduction

Describe Zope, Work in progress, see #242

Setup

1. Install virtualenv

easy_install virtualenv

2. As a non-root-user, create a virtualenv to house your sandbox (use any path other than /path/to/env that suits you):

virtualenv --no-site-packages /path/to/env

3. cd into the virtual environment and install the setuptools package using the virtual environment's easy_install command:

cd /path/to/env
bin/easy_install -U setuptools

4. Install the repoze.plone package in the virtual environment:

bin/easy_install -i http://dist.repoze.org/plone/latest/simple repoze.plone

5. Install PyAMF and any other dependencies your project requires in the virtual environment:

bin/easy_install pyamf

6. Once the repoze.plone package and its dependencies are installed, you must create "instance" files using the mkzope2instance script installed into the virtualenv:

bin/mkzope2instance .

7. Create manager account:

bin/addzope2user admin admin

If you're getting this error:

  File """/path/to/env/lib/python2.4/site-packages/ploneproducts-3.1.1-py2.4.egg/Products/
           CMFPlone/migrations/v3_1/betas.py""", line 8, in ?
    from Products.GenericSetup.browser.manage import ImportStepsView
ImportError: No module named manage

try:

bin/easy_install -i http://dist.repoze.org/plone/latest/simple -U Products.GenericSetup

8. Run the server by executing:

bin/paster serve etc/zope2.ini

which should show something like:

...
Starting server in PID 13691.
zserver on port 8080

Example

1. Create a file called gateway.py with the following content:

from pyamf import remoting.gateway.wsgi.WSGIGateway

# This is a function that we will expose
def echo(data):
   # echo data back to the client
   return data

services = {
   'echo': echo,
   # Add other exposed functions here
}

GatewayController = WSGIGateway(services)

2. Browse to http://localhost:8080/manage and select "Script (Python)" from the "Select type to add..." drop-down menu:


3. Use the id "gateway", browse to the gateway.py file and click the "Add" button:


4. Browse to http://localhost:8080/gateway which should show something like:

5. Create a file called crossdomain.xml with the following content"


6. Add the file to Zope:

http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/BasicObject.stx/Figures/addfile.jpg

Attachments