FAQ

Request parameters

How do I extract request parameters

Request parameters come from the context object (but beware this: ). You adapt the context object to an IRequest object. The parameters are stored in the args dictionary.

request = inevow.IRequest(ctx)
if request.args.has_key('myparam'):
   validate(request.args['myparam'])

Testing

How do I make fake context objects?

Divmod contains a testutil module that contains a set of ready made classes like FakeRequest, FakeSession etc. Use these. Example:

ctx = context.WebContext(tag=page)
ctx.remember(testutil.AccumulatingFakeRequest())
jethro@divmod.org