>From the session example in the cookbook:

import web
web.config.debug = False
urls = (
    "/count", "count",
    "/reset", "reset"
)
app = web.application(urls, locals())
session = web.session.Session(app, web.session.DiskStore('sessions'),
initializer={'count': 0})

class count:
    def GET(self):
        session.count += 1
        return str(session.count)

class reset:
    def GET(self):
        session.kill()
        return ""

if __name__ == "__main__":
    app.run()

============

The initializer parameter here sets 'count' to 0.

My question.. it the initalizer where I set key and values I want to
stuff in the session?  Can there be any other variable aside from
'count'.. Like if I change 'count' to 'Bob' I get this:

  File "/Users/mmarch/PYTHONENV/WEBPY_31/lib/python2.5/site-packages/
web/application.py", line 242, in process
    return self.handle()
  File "/Users/mmarch/PYTHONENV/WEBPY_31/lib/python2.5/site-packages/
web/application.py", line 233, in handle
    return self._delegate(fn, self.fvars, args)
  File "/Users/mmarch/PYTHONENV/WEBPY_31/lib/python2.5/site-packages/
web/application.py", line 412, in _delegate
    return handle_class(cls)
  File "/Users/mmarch/PYTHONENV/WEBPY_31/lib/python2.5/site-packages/
web/application.py", line 387, in handle_class
    return tocall(*args)
  File "test2.py", line 12, in GET
    session.Bob += 1
  File "/Users/mmarch/PYTHONENV/WEBPY_31/lib/python2.5/site-packages/
web/utils.py", line 923, in __getattr__
    return getattr(self._getd(), key)
  File "/Users/mmarch/PYTHONENV/WEBPY_31/lib/python2.5/site-packages/
web/utils.py", line 68, in __getattr__
    raise AttributeError, k
AttributeError: 'Bob'
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to