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

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

examples/pool.spy
[[.import names="pool"]]
<html><body>
  The pool module supports long-lived server-pooled objects,<br>
  useful for database connections, and other variables<br>
  that are expensive to compute.<br>
  [[\
    if pool.has_key('foo'):
      print 'Pooled object foo EXISTS.'
    else:
      pool['foo'] = 1
      print 'Pooled object foo CREATED.'
  ]]
  <br>
  Value: [[=pool['foo'] ]] <p>
  The pool module also gives access to server variables set in
  the server configuration file: <br>
  [[=pool.server]]<br>
  <b>Note:</b> This example requires a long-lived server to
  function correctly, i.e. non-CGI environment.
</body></html>
Run this code.
(requires Spyce-enabled web server)

Back to List of Examples


© 2002-05 Rimon Barr
email: rimon@acm.org
Spyce Powered SourceForge Logo [[ Spyce ]]
Python Server Pages
version 1.3.13