liquid_feedback_frontend
view config/init.lua @ 729:f52f918b38b8
Cleanup of config and orphaned code
| author | bsw | 
|---|---|
| date | Thu Jun 28 17:07:00 2012 +0200 (2012-06-28) | 
| parents | |
| children | 0015fa6eb637 | 
 line source
     1 request.set_404_route{ module = 'index', view = '404' }
     3 -- open and set default database handle
     4 db = assert(mondelefant.connect{
     5   engine='postgresql',
     6   dbname='liquid_feedback'
     7 })
     8 at_exit(function() 
     9   db:close()
    10 end)
    11 function mondelefant.class_prototype:get_db_conn() return db end
    13 -- enable output of SQL commands in trace system
    14 function db:sql_tracer(command)
    15   return function(error_info)
    16     local error_info = error_info or {}
    17     trace.sql{ command = command, error_position = error_info.position }
    18   end
    19 end
    21 request.set_absolute_baseurl(config.absolute_base_url)
    25 -- TODO abstraction
    26 -- get record by id
    27 function mondelefant.class_prototype:by_id(id)
    28   local selector = self:new_selector()
    29   selector:add_where{ 'id = ?', id }
    30   selector:optional_object_mode()
    31   return selector:exec()
    32 end
