Dudek 146 zope example zope exam dtml var

Info icon This 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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern