webmcp

changeset 258:46f0083889a9

Initialize global variable 'app' on every request
author jbe
date Sun Mar 15 01:08:00 2015 +0100 (2015-03-15)
parents 78a2ae40c88e
children 41be09ce6aa3
files framework/env/__init.lua framework/env/request/handler.lua
line diff
     1.1 --- a/framework/env/__init.lua	Sun Mar 15 01:06:04 2015 +0100
     1.2 +++ b/framework/env/__init.lua	Sun Mar 15 01:08:00 2015 +0100
     1.3 @@ -48,14 +48,6 @@
     1.4  require 'mondelefant_atom_connector'
     1.5  
     1.6  --[[--
     1.7 -app  -- table to store an application state
     1.8 -
     1.9 -'app' is a global table for storing any application state data
    1.10 ---]]--
    1.11 -app = {}
    1.12 ---//--
    1.13 -
    1.14 ---[[--
    1.15  config  -- table to store application configuration
    1.16  
    1.17  'config' is a global table, which can be modified by a config file of an application to modify the behaviour of that application.
     2.1 --- a/framework/env/request/handler.lua	Sun Mar 15 01:06:04 2015 +0100
     2.2 +++ b/framework/env/request/handler.lua	Sun Mar 15 01:08:00 2015 +0100
     2.3 @@ -19,6 +19,7 @@
     2.4  
     2.5  -- TODO: function incomplete yet
     2.6  function request.handler(http_request)
     2.7 +  _G.app = {}  -- may be overwritten or modified by request initializers
     2.8    do
     2.9      local first = not request._in_progress
    2.10      request._in_progress = true  -- NOTE: must be set to true before initializer functions are called
    2.11 @@ -246,3 +247,15 @@
    2.12    end
    2.13  
    2.14  end
    2.15 +
    2.16 +--//--
    2.17 +
    2.18 +--[[--
    2.19 +app  -- table to store an application state
    2.20 +
    2.21 +'app' is a global table for storing any application state data. It will be reset for every request.
    2.22 +--]]--
    2.23 +
    2.24 +-- Initialized in request.handler(...).
    2.25 +
    2.26 +--//--

Impressum / About Us