comparison mod_register_web/mod_register_web.lua @ 1459:742f3dc601b5

mod_register_web: Use path separator from package.config
author Kim Alvefur <zash@zash.se>
date Fri, 27 Jun 2014 20:57:51 +0200
parents e670d4cc5027
children 5e1f7af23cf0
comparison
equal deleted inserted replaced
1458:e9d164e694e7 1459:742f3dc601b5
1 local captcha_options = module:get_option("captcha_options", {}); 1 local captcha_options = module:get_option("captcha_options", {});
2 local nodeprep = require "util.encodings".stringprep.nodeprep; 2 local nodeprep = require "util.encodings".stringprep.nodeprep;
3 local usermanager = require "core.usermanager"; 3 local usermanager = require "core.usermanager";
4 local http = require "net.http"; 4 local http = require "net.http";
5 local path_sep = package.config:sub(1,1);
5 6
6 local extra_fields = { 7 local extra_fields = {
7 nick = true; name = true; first = true; last = true; email = true; 8 nick = true; name = true; first = true; last = true; email = true;
8 address = true; city = true; state = true; zip = true; 9 address = true; city = true; state = true; zip = true;
9 phone = true; url = true; date = true; 10 phone = true; url = true; date = true;
13 -- Like util.template, but deals with plain text 14 -- Like util.template, but deals with plain text
14 return { apply = function(values) return (data:gsub("{([^}]+)}", values)); end } 15 return { apply = function(values) return (data:gsub("{([^}]+)}", values)); end }
15 end 16 end
16 17
17 local function get_template(name) 18 local function get_template(name)
18 local fh = assert(module:load_resource("templates/"..name..".html")); 19 local fh = assert(module:load_resource("templates"..path_sep..name..".html"));
19 local data = assert(fh:read("*a")); 20 local data = assert(fh:read("*a"));
20 fh:close(); 21 fh:close();
21 return template(data); 22 return template(data);
22 end 23 end
23 24