webmcp
annotate framework/env/request/configure.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 |
| rev | line source |
|---|---|
| jbe@262 | 1 --[[-- |
| jbe@262 | 2 request.configure( |
| jbe@262 | 3 func -- function which is performing the configuration |
| jbe@262 | 4 ) |
| jbe@262 | 5 |
| jbe@262 | 6 Registers a function to be called on every request only if a request is not in progress yet. Executes the function once in any case. |
| jbe@262 | 7 |
| jbe@262 | 8 --]]-- |
| jbe@262 | 9 |
| jbe@262 | 10 function request.configure(func) |
| jbe@262 | 11 if not request._in_progress then |
| jbe@262 | 12 local initializers = request._initializers |
| jbe@262 | 13 initializers[#initializers+1] = func |
| jbe@262 | 14 end |
| jbe@262 | 15 func() |
| jbe@262 | 16 end |