You are not logged in Log in Join
You are here: Home » Members » Chui Tey » Build a minimal ZPublisher based distribution

Log in
Name

Password

 

Build a minimal ZPublisher based distribution

Introduction

I wanted to bundle up ZPublisher and ZServer but I didn't want the rest of Zope, ie. ZODB and the rest, so that I can operate in the old style bobo-mode.

Steps

  1. You will need Zope 2.5
  2. Create a blank directory
  3. Copy the following directories from Zope 2.5 and place them in the blank directory
    • lib/python/zLog
    • lib/python/ZPublisher
    • lib/python/zExceptions
    • ZServer
  4. You will need the following files as well
    • z2.py
    • lib/python/LOG.py
  5. Modify z2.py and fix references to swhome.
  6. In z2.py, create a variable called CLIENT_HOME and point it to the directory where log files will be created. For example:
           CLIENT_HOME='var'
    
  7. Change MODULE=Zope to the name of the module you would like to publish. For instance 'TEST':
         # TEST.py
         "test module"
    
         class TEST:
            "test class"
    
            def index_html(self, REQUEST):
                "Obligatory doc string"
    
                return "<HTML>HELLO!</HTML>"
    
         def index_html():
            "Obligatory doc_string"
    
            return "<HTML>HELLO FROM THE MODULE!</HTML>"
    
         def testme(REQUEST):
    
            instance = TEST()
            return TEST.index_html(REQUEST)
    
         def shutdown():
           "End"
           import sys
           sys.exit(0)
    
  8. Test the webserver:
         * python z2.py -w80
    
         * http://localhost/
    
         * http://localhost/index_html
    
         * http://localhost/testme
    
         * http://localhost/shutdown
    
         * http://localhost/testme