spyce
home
license
community
download
examples
resources
wishlist
contrib (@sf)
documentation
intro
lang
runtime
modules
tags
install
exits
sourceforge
statistics
freshmeat

transparent transparent transparent
Examples
[[ Spyce ]]
Python Server Pages
by Rimon Barr

examples/autosessionpost.spy
[[.import name=session args="'session_dir','/tmp', auto=(10,'post','mysession')"]]
<html><body>
  [[-- count visits --]]
  [[\
    if not session.auto: session.auto = 1
    else: session.auto = session.auto + 1
  ]]
  [[-- output --]]
  You have visited this page [[=session.auto]] time(s)<br>
  Your autosession ID is: [[=session.autoID]]<br>
  Autosession expiration = 10 seconds.<br>
  <table><tr>
    <td>
      <form method=post>
        <input type=submit value=Refresh>
        <input type=hidden name=mysession value=[[=session.autoID]]>
      </form>
      </td><td>
      <form method=post>
        <input type=submit value=Clear>
      </form>
    </td>
  </tr></table><br>
  <b>Note:</b> This example requires write access to 
  the /tmp directory to function correctly.
</body></html>
Run this code.
(requires Spyce-enabled web server)

Back to List of Examples


© 2002 Rimon Barr
email: rimon AT acm DOT org
Spyce Powered SourceForge Logo [[ Spyce ]]
Python Server Pages
version 1.3.10