webmcp

diff framework/env/request/get_json_request_slots.lua @ 1:985024b16520

Version 1.0.1

New feature: JSON requests

Changes in ui.paginate: Current page setting is directly fetched from CGI params, instead of view params

Changed behavior of load methods of atom library to accept nil as input

Bugfixes in mondelefant_atom_connector timestamp(tz) loaders

Added global constant _WEBMCP_VERSION containing a version string
author jbe
date Tue Nov 17 12:00:00 2009 +0100 (2009-11-17)
parents
children 605488fbf809
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/framework/env/request/get_json_request_slots.lua	Tue Nov 17 12:00:00 2009 +0100
     1.3 @@ -0,0 +1,15 @@
     1.4 +--[[--
     1.5 +slot_idents =                    -- list of names of slots to be returned as JSON data
     1.6 +request.get_json_request_slots()
     1.7 +
     1.8 +If the current request is no JSON request, this function returns nil, otherwise a list of names of all slots to be returned in JSON format. This function also throws an error, if JSON data was requested, but request.set_allowed_json_request_slots(...) has not been called.
     1.9 +
    1.10 +--]]--
    1.11 +
    1.12 +function request.get_json_request_slots(slot_idents)
    1.13 +  local slot_idents = cgi.params["_webmcp_json_slots[]"]
    1.14 +  if slot_idents and not request._json_requests_allowed then
    1.15 +    error("JSON requests have not been allowed using request.set_allowed_json_request_slots(...).")
    1.16 +  end
    1.17 +  return slot_idents
    1.18 +end

Impressum / About Us