webmcp
view framework/env/request/for_each.lua @ 438:ea8419658535
Another change to make <db_object>:try_save() work properly with "document_column"
(use "_col" proxy also for accessing self._col[primary_key.json_doc])
(use "_col" proxy also for accessing self._col[primary_key.json_doc])
author | jbe |
---|---|
date | Wed Jan 20 21:06:07 2016 +0100 (2016-01-20) |
parents | c3d539e33710 |
children |
line source
1 --[[--
2 request.for_each(
3 func -- function to be called on every request
4 )
6 Registers a function to be called on every request and executes it once. This mechanism can be used for __init.lua files in the environment to perform a per-request initialization. See env/request/__init.lua for an example.
8 --]]--
10 function request.for_each(func)
11 local initializers = request._initializers
12 initializers[#initializers+1] = func
13 func()
14 end