Archive for the ‘Zope’ Category

Zope heads towards WSGI and Twisted integration

June 25, 2006

The latest zope 2.10.0-beta, includes experimental WSGI and Twisted integration. The Web Server Gateway Interface defines a simple and universal interface between web servers and web applications or frameworks for the Python Programming language. This will bring a universal interface for easier integration of web applications/frameworks and servers.

Twisted is an event-driven asynchronous networking framework written in Python and licensed under the Free Software MIT license. It supports TCP, UDP, multicast, SSL/TLS, serial communication and more.

Zope now has a WSGI interface for integration with other web-servers than ZServer. Most notably Twisted is supported. The WSGI application is ZPublisher.WSGIPublisher.publish_module

You can make ZServer use the twisted interface with the "use-wsgi on" keyword in the http-server section in zope.conf.

You can run Twisted by installing Twisted (2.1 recommended) and replacing the http-server section with a server section in zope.conf.

It is not possible to run a Twisted server together with a ZServer at the same time.



 There are also several changes towards Zope3 withseveral Zope 2 modules replaced with their sister implementation of Zope 3, and the ZPT (Zope Page Templates) is also based on Zope3.

Zope Page Templates (ZPT) are an HTML/XML generation tool.

The ZPT standards include: Tag Attribute Language (TAL), TAL Expression Syntax (TALES), and Macro Expansion TAL (METAL).


OIO Advanced Form Controls tutorial example

June 17, 2006

This is a really cool feature in OIO!

Let us go through an example tutorial. Let us make an advanced interactive web form which will allow us to record
1. date of operation
2. system – upper GI, Urinary, Lower limb etc. as a pickone list. Choosing one will open a list of operations, related only to that system, in the third field called
3. operation

Then we add a yes no field to note if there was a post operative complication, and if yes is chosen, a text box opens to write the details, right?

Start OIO and click the forms menu and then pick Add_a_new_form
Give the form a name Oplist (first letter is a capital letter)
Add a new question item called
system (field type is blank) and another called operation (type is blank too).
Archive it by clicking the now button, then click create a new version.
We have an archived form called Oplist_v0

Next create another new form called Operations (first letter capital)

click “add a new response type”
call it system (all simple letters)
form,question item=Oplist_v0,system

click “add item type” button.

Click “add a new response type” again.
From, question item=Oplist_v0, operation
click add item type button

Click “add a new response type” again.
choice=no, yes
click add item type button

You should be really careful about what you type, as any typing erors …er errors will cost you time!

Remember, if you are short of time, go slowly!!!

We have now added the necessary new response types, so let’s create the Operations form.

Add a new question item
item name= date
question prompt=Date of operation
click “add item”

Add a new question item
item name= system
question prompt=System
Response=system (choose this from the list)
click “add item”

Add a new question item
item name= operation
question prompt=Operation
click “add item”

Add a new question item
item name= complication
question prompt=Complication
click “add item”

Add a new question item
item name= description
question prompt=Describe complication
click “add item”

That’s it!

Let us test it out first.

Forms – myforms
click the Operations forms under the column “name”
click preview/test form

If some of the items in the eg:operation is in red letters and the box in front is missing – you have made a mistake – check response types to see if there are spelling mistakes when writing eg: Oplist_v0 where you have typed in the letter o instead of the number 0 for example 😉

Let us add some stuff.

Patients-my patients -add a patient called first name “abc” last name “formipig” – sort of like guninea pig ;-), choose this patient from the list and click “forms” and open the Oplist form

add these and click add each time

system=upper limb
operation=Carpal Tunnel Decompression

system=lower limb
operation= Total Knee Replacement

system=lower limb
operation=Total Hip Replacement

Go on, enjoy yourself!


Let us now try out our advanced form called Operations

from within a patient, choose the Operations_ v0

Pick one from the list in System and see how the operation in the next list is not selected but all that you typed in are sen in the list.

Choose from the list on the left, saying “archive” by default, advanced form controls and click “now”.

If SELECT is seen

if system constrains operation then use column system
(type things carefully no spelling mistakes or capitalization errors)

click SET

Now do this.

If complication equals yes (type this word in) then reveal describe
click SET
click COMMIT

Now under a patient, choose the form Operation and see how things work!

If you need to add more to the system and operations, open the form Oplist under patient “formipig” and start filling in!

Installing OIO 1.1.0 in Ubuntu Linux – Breezy.

May 13, 2006

Installing zope on ubuntu took some time.

To do it with debs: Apt-get the following stuff – can use synaptic (system-administration-synaptic package manager):

  • build-essential
  • python2.3 and python2.3-dev
  • python2.3-xml
  • python2.3-imaging
  • postgresql server and client -use 8.0 version
  • postgresql common
  • postgresql-server-dev
  • libpq-dev
  • zope2.7-psycopgda
  • zope-parsedxml

parsedxml package may be downloaded and installed by simply unpacking it in the usr/lib/zope2.7/lib/python/Products directory


as superuser – sudo su
Create a zopeinstance for yourself.

As su

Give the directory – /home/yourname/oioinstance give the username and password

start the instance
/home/yourname/oioinstance/bin/zopectl fg Everything OK? Ctrl-C to shutdown

ZpsycopgDA in Ubuntu is in /usr/share/zope/Products

then from my INSTANCE_HOME of /home/yourname/oioinstance/Products as sudo

  • sudo ln -s /usr/share/zope/Products/ParsedXML

Start zope and see if these products are available in ZMI

look at
There is a zope.conf file.

Edit zope.conf

Look at this part
%define INSTANCE_NAME zope2.7instance
%define INSTANCE /home/yournamel/zope2.7instance %define ZOPE_NAME zope2.7
%define ZOPE /usr/lib/zope2.7
%define ZOPE_USER zope
%define HTTPPORT 9673

ZOPE_USER has to be postgres.

%define ZOPE_USER postgres
chown -R postgres:postgres /home/yourname/oioinstance and chown -R postgres:postgres var/log/zope2.7/oioinstance

start zope
sudo su postgres

/home/yourname/oioinstance/bin/ zopectl fg

log into the ZMI by opening the browser and localhost:9673/manage
Give the userid admin and the password you used, originally. Add a manager user for your use.


Postgresql 8.0 in Ubuntu can run at startup automatically.
To control postgresql via a GUI interface download pgadmin3 via apt or synaptic and start it by typing pgadmin3 at the prompt in a terminal.Postgresql commands are in


To initialize the database and run the postmaster server do this

sudo su postgres (give you Ubuntu password when asked)

cd /usr/lib/postgresql/8.0/bin

./initdb -D /var/lib/postgresql/data

there will be some happy messages of success!!

From now on to start the postmaster
as postgres
$ cd /usr/lib/postgresql/8.0/bin/
$ ./postmaster -D /var/lib/postgresql/data

You get

LOG: database system was shut down at 2006-04-07 07:56:38 MDT
LOG: checkpoint record is at 0/B68CB8
LOG: redo record is at 0/B68CB8; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 1368; next OID: 17451
LOG: database system is ready
If you want to close it down do Ctrl-C at the terminal

Open another terminal, su to postgres user
cd space enter to go to the home directory of postgres
createdb local_text
createdb publicdb

Or just start pgadmin3
add server from file menu or right clickl on the “servers”
address= localhost
description = pgserver
inital db=template1
need password – clicked
password=type in password with great care 🙂

when it appears right click and click connect. Enter password when asked.
Now right click on it and add the databases

Now add OIO

Zope and postgresql are installed and both servers running.

Zope has to be started by postgres user.

Put the in the import directory
sudo su
cd to the import directory
chown -R postgres:postgres OIO
cd OIO

when asked for the zope directory give
when asked for the instance give

login to ZMI, open the acl_user folderadd user oio role as manager with password

close browser

run browser again and login to ZMI
In the root folder import tab and import oio.zexp -will say done!
(Sometimes in certain versions of zope In control panel Products import tab and import oio.zexp -will say done! Now get to the root directory and add an oio instance id=oio}

Refresh browser
click OIO folder in the left panel and get to Properties tab
my_database to publicdb

auto_his_assignments – change to no ( it is set as “yes” by default )

Correct the URL of the base_URL (at the bottom part of web form) as follows
Set the external base and forms URL to the same as above

Set the reports URL to
transaction_URL to
save changes NOW!

Refresh browser
click OIO folder in the left panel and get to
click on define_initial_tables on the right panel
click on the view tab
DONE! should appear.

Refresh browser

navigate to OIO/postgres/initialize/
Click on run_me on the right panel
click on view tab
Some succesfull messages will run with All Done! at the end, and you will be asked to
create first oio user =oio
Done! should appear.

All Done!

close browser

start browser as http://localhost:9673/OIO

zope catches up with python

March 22, 2006

The Zope 2.9 series uses Python 2.4. Until this time Zope 2 was using 2.3. This was not very pleasing as the many advances made to python upgrading from 2.3 were not been made use of. Since Zope is pythons’ killer application, it was sad for python too. I found that some python software could not be used in zope due to this.
There would have to be upgrades of most zope Products now, to work in this new envioroment. How is python 2.4 better than 2.3? It is faster! Read the highlights here:

Zope 3.2 the latest stable version of the Zope 3 also runs on python 2.4. One important change here is the change of the server from ZServer to Twisted server.The Twisted server supports all that the ZServer supporting as well as HTTP over SSL natively and SFTP (disabled for now because of error handling problems). Also in the future it brings a better chance of other non-HTTP related protocols from being implemented for Zope3, like SMTP-in and IMAP.

The 2.9 and 3.2 versions of Zope both use the new ZODB 3.6. The ZODB is a persistence system for Python objects. Persistent programming languages provide facilities that automatically write objects to disk and read them in again when they’re required by a running program. By installing the ZODB, you add such facilities to Python.

Though there will be some hiccoughs as the migration occurs this is a positive step!