liquid_feedback_frontend
annotate 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 |
rev | line source |
---|---|
bsw@729 | 1 request.set_404_route{ module = 'index', view = '404' } |
bsw@729 | 2 |
bsw@729 | 3 -- open and set default database handle |
bsw@729 | 4 db = assert(mondelefant.connect{ |
bsw@729 | 5 engine='postgresql', |
bsw@729 | 6 dbname='liquid_feedback' |
bsw@729 | 7 }) |
bsw@729 | 8 at_exit(function() |
bsw@729 | 9 db:close() |
bsw@729 | 10 end) |
bsw@729 | 11 function mondelefant.class_prototype:get_db_conn() return db end |
bsw@729 | 12 |
bsw@729 | 13 -- enable output of SQL commands in trace system |
bsw@729 | 14 function db:sql_tracer(command) |
bsw@729 | 15 return function(error_info) |
bsw@729 | 16 local error_info = error_info or {} |
bsw@729 | 17 trace.sql{ command = command, error_position = error_info.position } |
bsw@729 | 18 end |
bsw@729 | 19 end |
bsw@729 | 20 |
bsw@729 | 21 request.set_absolute_baseurl(config.absolute_base_url) |
bsw@729 | 22 |
bsw@729 | 23 |
bsw@729 | 24 |
bsw@729 | 25 -- TODO abstraction |
bsw@729 | 26 -- get record by id |
bsw@729 | 27 function mondelefant.class_prototype:by_id(id) |
bsw@729 | 28 local selector = self:new_selector() |
bsw@729 | 29 selector:add_where{ 'id = ?', id } |
bsw@729 | 30 selector:optional_object_mode() |
bsw@729 | 31 return selector:exec() |
bsw@729 | 32 end |
bsw@729 | 33 |