webmcp
view demo-app/config/demo.lua @ 52:2a3257f29c02
Added "return false" to onclick event of action links with href="#"
| author | jbe | 
|---|---|
| date | Fri Jun 10 14:58:22 2011 +0200 (2011-06-10) | 
| parents | 72860d232f32 | 
| children | 2169a62e12f5 | 
 line source
     1 -- uncomment the following two lines to use C implementations of chosen
     2 -- functions and to disable garbage collection during the request, to
     3 -- increase speed:
     4 --
     5 -- require 'webmcp_accelerator'
     6 -- collectgarbage("stop")
     8 -- open and set default database handle
     9 db = assert(mondelefant.connect{
    10   engine='postgresql',
    11   dbname='webmcp_demo'
    12 })
    13 at_exit(function() 
    14   db:close()
    15 end)
    16 function mondelefant.class_prototype:get_db_conn() return db end
    18 -- enable output of SQL commands in trace system
    19 function db:sql_tracer(command)
    20   return function(error_info)
    21     local error_info = error_info or {}
    22     trace.sql{ command = command, error_position = error_info.position }
    23   end
    24 end
    26 -- 'request.get_relative_baseurl()' should be replaced by the absolute
    27 -- base URL of the application, as otherwise HTTP redirects will not be
    28 -- standard compliant
    29 request.set_absolute_baseurl(request.get_relative_baseurl())
    31 -- uncomment the following lines, if you want to use a database driven
    32 -- tempstore (for flash messages):
    33 --
    34 -- function tempstore.save(blob)
    35 --   return Tempstore:create(blob)
    36 -- end
    37 -- function tempstore.pop(key)
    38 --   return Tempstore:data_by_key(key)
    39 -- end
    42 function mondelefant.class_prototype:by_id(id)
    43   return self:new_selector()
    44     :add_where{ "id = ?", id }
    45     :optional_object_mode()
    46     :exec()
    47 end
