[Nitro] flare quickfix and question

Robert Mela rob at robmela.com
Sun Nov 26 14:40:16 EST 2006


Started flare and tried http://localhost:9000/admin

Got "undefined local variable or method `sitepath' for 
#<AdminController:0x28814dc>"

Added this to to nitro/lib/part/admin/helper.rb, which fixes the 
problem, and puts something halfway appropriate in the title bar of the 
browser:

  def sitepath
     "#{@request.headers['REQUEST_URI']} on 
#{@request.headers['SERVER_NAME']}"
  end

I can now manage the og database for flare.

There is a class SitePath in skin.rb.   SitePath's render produces a 
clickable sitepath ( breadcrumb ) trail.    So should this 'sitepath' 
method in helper.rb should be called 'title_path' or something? 

Better yet, maybe templates could get request headers directly from the 
Request object, via methods like '@request.get_header_request_uri' -- 
methods dynamically added as they are needed ( kind of like 
ActiveRecord's find_by_.... )

FWIW, I'd be happy to file a ticket with a patch, but I keep getting 
that nearly-blank "(error)" page when i try to reset my password.
***

Looked at the stack trace:

*
/Users/robertmela/nitro/src/nitro/lib/nitro/publishable.rb:109:in 
`method_missing' <http://localhost:9000/admin#>
104: base.module_eval do
105: def method_missing(action, *args)
106: if Compiler.new(self.class).compile(action)
107: send(action, *args)
108: else
109: super
110: end
111: end
112: end
113:
114: # Does this publishable respond to the given action?
/Users/robertmela/nitro/src/nitro/lib/part/admin/template/index.xhtml:8:in 
`index_template' <http://localhost:9000/admin#>
1: @out << <<NITRO_TEMPLATE_DELIMETER
2:
3:
4: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5:
6: <html xmlns="http://www.w3.org/1999/xhtml">
7:
8: <head profile="http://gmpg.org/xfn/1">
9: <title>George Moschovitis</title>
10: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
11: <meta name="generator" content="Nitro" />
(eval):33:in `index_action' <http://localhost:9000/admin#>
/Users/robertmela/nitro/src/nitro/lib/nitro/publishable.rb:107:in 
`method_missing' <http://localhost:9000/admin#>
102: # for this controller.
103:
104: base.module_eval do
105: def method_missing(action, *args)
106: if Compiler.new(self.class).compile(action)
107: send(action, *args)
108: else
109: super
110: end
111: end
112: end
/Users/robertmela/nitro/src/nitro/lib/nitro/render.rb:129:in `render' 
<http://localhost:9000/admin#>
124:
125: if self.class == @controller
126: self.send(action)
127: else
128: puts "context='#{@context}' action='#{action}'\n"
129: @controller.new(@context).send(action)
130: end
131:
132: Controller.replace_current(old_controller)
133: @context.level -= 1
134:
/Users/robertmela/nitro/src/nitro/lib/nitro/adapter/webrick.rb:171:in 
`do_GET' <http://localhost:9000/admin#>
166: context.headers['REQUEST_URI'] = '/' + context.headers['REQUEST_URI']
167:
168: Cgi.parse_params(context)
169: Cgi.parse_cookies(context)
170:
171: context.render(path)
172:
173: res.status = context.status
174: res.instance_variable_set(:@header, context.response_headers || {})
175: res.instance_variable_set(:@cookies, context.response_cookies || {})
176: res.body = context.out
/usr/local/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in `service' 
<http://localhost:9000/admin#>
30: end
31:
32: def service(req, res)
33: method_name = "do_" + req.request_method.gsub(/-/, "_")
34: if respond_to?(method_name)
35: __send__(method_name, req, res)
36: else
37: raise HTTPStatus::MethodNotAllowed,
38: "unsupported method `#{req.request_method}'."
39: end
40: end
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' 
<http://localhost:9000/admin#>
99: raise HTTPStatus::NotFound, "`#{req.path}' not found." unless servlet
100: req.script_name = script_name
101: req.path_info = path_info
102: si = servlet.get_instance(self, *options)
103: @logger.debug(format("%s is invoked.", si.class.name))
104: si.service(req, res)
105: end
106:
107: def do_OPTIONS(req, res)
108: res["allow"] = "GET,HEAD,POST,OPTIONS"
109: end
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' 
<http://localhost:9000/admin#>
60: res.keep_alive = req.keep_alive?
61: server = lookup_server(req) || self
62: if callback = server[:RequestCallback] || server[:RequestHandler]
63: callback.call(req, res)
64: end
65: server.service(req, res)
66: rescue HTTPStatus::EOFError, HTTPStatus::RequestTimeout => ex
67: res.set_error(ex)
68: rescue HTTPStatus::Error => ex
69: @logger.error(ex.message)
70: res.set_error(ex)
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' 
<http://localhost:9000/admin#>
168: rescue SocketError
169: @logger.debug "accept: <address unknown>"
170: raise
171: end
172: call_callback(:AcceptCallback, sock)
173: block ? block.call(sock) : run(sock)
174: rescue Errno::ENOTCONN
175: @logger.debug "Errno::ENOTCONN raised"
176: rescue ServerError => ex
177: msg = "#{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}"
178: @logger.error msg
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' 
<http://localhost:9000/admin#>
157: end
158: return sock
159: end
160:
161: def start_thread(sock, &block)
162: Thread.start{
163: begin
164: Thread.current[:WEBrickSocket] = sock
165: begin
166: addr = sock.peeraddr
167: @logger.debug "accept: #{addr[3]}:#{addr[1]}"
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start' 
<http://localhost:9000/admin#>
90: begin
91: if svrs = IO.select(@listeners, nil, nil, 2.0)
92: svrs[0].each{|svr|
93: @tokens.pop # blocks while no token is there.
94: if sock = accept_client(svr)
95: th = start_thread(sock, &block)
96: th[:WEBrickThread] = true
97: thgroup.add(th)
98: else
99: @tokens.push(nil)
100: end
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start' 
<http://localhost:9000/admin#>
87: thgroup = ThreadGroup.new
88: @status = :Running
89: while @status == :Running
90: begin
91: if svrs = IO.select(@listeners, nil, nil, 2.0)
92: svrs[0].each{|svr|
93: @tokens.pop # blocks while no token is there.
94: if sock = accept_client(svr)
95: th = start_thread(sock, &block)
96: th[:WEBrickThread] = true
97: thgroup.add(th)
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start' 
<http://localhost:9000/admin#>
18:
19: class ServerError < StandardError; end
20:
21: class SimpleServer
22: def SimpleServer.start
23: yield
24: end
25: end
26:
27: class Daemon
28: def Daemon.start
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start' 
<http://localhost:9000/admin#>
77:
78: def start(&block)
79: raise ServerError, "already started." if @status != :Stop
80: server_type = @config[:ServerType] || SimpleServer
81:
82: server_type.start{
83: @logger.info \
84: "#{self.class}#start: pid=#{$$} port=#{@config[:Port]}"
85: call_callback(:StartCallback)
86:
87: thgroup = ThreadGroup.new
/Users/robertmela/nitro/src/nitro/lib/nitro/adapter/webrick.rb:66:in 
`start' <http://localhost:9000/admin#>
61:
62: @webrick.mount('/', WebrickAdapter, server)
63:
64: initialize_webrick(server)
65:
66: @webrick.start
67: end
68:
69: # Stop the Webrick adapter.
70:
71: def stop
/Users/robertmela/nitro/src/nitro/lib/nitro/server/runner.rb:323:in 
`invoke_server' <http://localhost:9000/admin#>
318: when :webrick
319: require 'nitro/adapter/webrick'
320: Logger.info "Starting Webrick on #{server.address}:#{server.port}"
321: Logger.info "Press Ctrl-C to shutdown; Run with --help for options."
322: Logger.info ""
323: Webrick.start(server)
324:
325: when :mongrel
326: require 'nitro/adapter/mongrel'
327: Logger.info "Starting Mongrel on #{server.address}:#{server.port}"
328: Logger.info "Press Ctrl-C to shutdown; Run with --help for options."
/Users/robertmela/nitro/src/nitro/lib/nitro/server/runner.rb:282:in 
`invoke' <http://localhost:9000/admin#>
277: $server = server
278: $app = ConsoleAdapter.new(server)
279: $cache = Caching::Proxy
280:
281: else
282: invoke_server(server)
283: end
284: end
285:
286: # ...
287:
/Users/robertmela/nitro/src/nitro/lib/nitro/server.rb:151:in `run' 
<http://localhost:9000/admin#>
146: Part.setup
147:
148: server = Server.new
149: server.start(options)
150:
151: runner.invoke(server) unless $NITRO_NO_INVOKE
152:
153: return server
154: end
155:
156: end
/Users/robertmela/nitro/src/nitro/lib/nitro.rb:77:in `start' 
<http://localhost:9000/admin#>
72: attr_accessor :server
73:
74: # A helper method to start a Nitro application.
75:
76: def run(controller = nil)
77: @server = Server.run(controller)
78: end
79: alias_method :start, :run
80:
81: # A helper method. Will be deprecated, use
82: # Configuration.mode instead.
app.rb:36 <http://localhost:9000/admin#>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rob.vcf
Type: text/x-vcard
Size: 116 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20061126/4a0bf243/attachment-0001.vcf 


More information about the Nitro-general mailing list