liquid_feedback_frontend

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/config/init.lua	Thu Jun 28 17:07:00 2012 +0200
     1.3 @@ -0,0 +1,33 @@
     1.4 +request.set_404_route{ module = 'index', view = '404' }
     1.5 +
     1.6 +-- open and set default database handle
     1.7 +db = assert(mondelefant.connect{
     1.8 +  engine='postgresql',
     1.9 +  dbname='liquid_feedback'
    1.10 +})
    1.11 +at_exit(function() 
    1.12 +  db:close()
    1.13 +end)
    1.14 +function mondelefant.class_prototype:get_db_conn() return db end
    1.15 +
    1.16 +-- enable output of SQL commands in trace system
    1.17 +function db:sql_tracer(command)
    1.18 +  return function(error_info)
    1.19 +    local error_info = error_info or {}
    1.20 +    trace.sql{ command = command, error_position = error_info.position }
    1.21 +  end
    1.22 +end
    1.23 +
    1.24 +request.set_absolute_baseurl(config.absolute_base_url)
    1.25 +
    1.26 +
    1.27 +
    1.28 +-- TODO abstraction
    1.29 +-- get record by id
    1.30 +function mondelefant.class_prototype:by_id(id)
    1.31 +  local selector = self:new_selector()
    1.32 +  selector:add_where{ 'id = ?', id }
    1.33 +  selector:optional_object_mode()
    1.34 +  return selector:exec()
    1.35 +end
    1.36 +

Impressum / About Us