Dudek 146 zope example zope exam dtml var

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: os # or break # but not on Windows, # and the code is very complex... time.sleep(1) CS 206 G. Dudek 142 Sessions • How to correlate requests from same user? – Assign session key on first contact – Incorporate session key in form or in URL – In form: use hidden input field: » <input type="hidden" name="session" value="1f9a2"> – In URL: » http://myhost.com/cgi-bin/myprog.py/1f9a2 » passed in environment (os.environ[...]): » PATH_INFO=/1f9a2 » PATH_TRANSLATED=<rootdir>/1f9a2 CS 206 G. Dudek 143 Avoiding fork() • Python in Apache (mod_pyapache) » » » » problems: stability; internal design advantage: CGI compatible may work if CGI scripts are simple and trusted doesn't avoid database connection delay • Use Python as webserver » slow for static content (use different port) » advantage: total control; session state is easy • FastCGI, HTTPDAPI etc. • ZOPE CS 206 G. Dudek 144 ZOPE • Z Object Publishing Environment bje ublishing – http://www.zope.org – complete dynamic website management tool » written in cross-platform Python; Open Source – Web server (incidental) – DTML: "templatized" HTML (embedded Python code) – ZOBD (Z Object DataBase; stores Python objects) DataBase » transactionsm selective undo, etc. tran selective – etc., etc. CS 206 G. Dudek 145 Zope example: Basic web Zope example: page(s) • Desired web pages all have common look: header text common to all pages actual body footer text common to all pages CS 206 G. Dudek 146 Zope example Zope exam • <dtml-var standard_header> • <h1>Hello</h1? • <dtml-var standard_footer> standard_footer> CS 206 G. Dudek 147 Case study CS 206 G. Dudek 148 FAQ wizard • Tools/faqwiz/faqwiz.py in Python py in distribution • http://www.python.org /cgi-bin/faqw.py CS 206 G. Dudek 149 faqw.py - bootstrap import os, sys im os try: FAQDIR = "/usr/people/guido/python/FAQ" SRCDIR = "/home/dudek/python/...
View Full Document

This note was uploaded on 04/02/2013 for the course MATH 222 taught by Professor Karlpeterrussell during the Spring '08 term at McGill.

Ask a homework question - tutors are online