[Nitro] help - stuck on basics again - more info

itsme213 itsme213 at hotmail.com
Fri Jun 30 13:43:49 EDT 2006


I would have no clue what to do with the stack trace, but here it is ...

Thanks for any clues!


c:/ruby/lib/ruby/gems/1.8/gems/og-0.30.0.1/lib/og/store/sql.rb:959:in 
`handle_sql_exception'
954: # :section: Misc methods.
955:
956: def handle_sql_exception(ex, sql = nil)
957: Logger.error "DB error #{ex}, [#{sql}]"
958: Logger.error ex.backtrace.join("\n")
959: raise StoreException.new(ex, sql) if Og.raise_store_exceptions
960:
961: # FIXME: should return :error or something.
962: return nil
963: end
964:
c:/ruby/lib/ruby/gems/1.8/gems/og-0.30.0.1/lib/og/store/sqlite.rb:87:in 
`query'
82:
83: def query(sql)
84: Logger.debug sql if $DBG
85: return @conn.query(sql)
86: rescue Exception => ex
87: handle_sql_exception(ex, sql)
88: end
89:
90: def exec(sql)
91: Logger.debug sql if $DBG
92: @conn.query(sql).close
c:/ruby/lib/ruby/gems/1.8/gems/og-0.30.0.1/lib/og/store/sql.rb:467:in `find'
462: # Comment.find(:include => :entry)
463:
464: def find(options)
465: klass = options[:class]
466: sql = resolve_options(klass, options)
467: read_all(query(sql), klass, options)
468: end
469:
470: # Find one object.
471:
472: def find_one(options)
c:/ruby/lib/ruby/gems/1.8/gems/og-0.30.0.1/lib/og/entity.rb:215:in `find'
210: end
211:
212: options[:class] = self
213: options[:type] = self if self.schema_inheritance_child?
214:
215: ogmanager.store.find(options)
216: end
217: alias_method :all, :find
218:
219: # Find a single instance of this class.
220:
(eval):45:in `find_attributes'
c:/ruby/lib/ruby/gems/1.8/gems/og-0.30.0.1/lib/og/collection.rb:73:in `send'
68:
69: # Load the members of the collection.
70:
71: def load_members
72: unless @loaded or @owner.unsaved?
73: @members = @owner.send(@find_proc, @find_options)
74: @loaded = true
75: end
76: @members
77: end
78:
c:/ruby/lib/ruby/gems/1.8/gems/og-0.30.0.1/lib/og/collection.rb:73:in 
`load_members'
68:
69: # Load the members of the collection.
70:
71: def load_members
72: unless @loaded or @owner.unsaved?
73: @members = @owner.send(@find_proc, @find_options)
74: @loaded = true
75: end
76: @members
77: end
78:
c:/ruby/lib/ruby/gems/1.8/gems/og-0.30.0.1/lib/og/collection.rb:104:in 
`each'
99: end
100:
101: # Defined to avoid the method missing overhead.
102:
103: def each(&block)
104: load_members
105: @members.each(&block)
106: end
107:
108: # Defined to avoid the method missing overhead.
109:
c:/ruby/lib/ruby/gems/1.8/gems/og-0.30.0.1/lib/og/collection.rb:189:in 
`remove_all'
184:
185: # Remove all members from the collection.
186:
187: def remove_all
188: @owner.transaction do
189: self.each { |obj| @owner.send(@remove_proc, obj) }
190: end
191: @members.clear
192: @loaded = false # gmosx: IS this needed?
193: end
194: alias_method :clear, :remove_all
c:/ruby/lib/ruby/gems/1.8/gems/og-0.30.0.1/lib/og/collection.rb:188:in 
`transaction'
183: end
184:
185: # Remove all members from the collection.
186:
187: def remove_all
188: @owner.transaction do
189: self.each { |obj| @owner.send(@remove_proc, obj) }
190: end
191: @members.clear
192: @loaded = false # gmosx: IS this needed?
193: end
c:/ruby/lib/ruby/gems/1.8/gems/og-0.30.0.1/lib/og/entity.rb:86:in 
`transaction'
81: self.class.ogmanager.store.delete(self, self.class, cascade)
82: end
83: alias_method :delete!, :delete
84:
85: def transaction(&block)
86: self.class.ogmanager.store.transaction(&block)
87: end
88:
89: # Is this object saved in the store?
90:
91: def saved?
c:/ruby/lib/ruby/gems/1.8/gems/og-0.30.0.1/lib/og/collection.rb:188:in 
`remove_all'
183: end
184:
185: # Remove all members from the collection.
186:
187: def remove_all
188: @owner.transaction do
189: self.each { |obj| @owner.send(@remove_proc, obj) }
190: end
191: @members.clear
192: @loaded = false # gmosx: IS this needed?
193: end
c:/ruby/lib/ruby/gems/1.8/gems/glue-0.30.0.1/lib/glue/property.rb:125:in 
`populate_object'
120: foreign_oid = preprocess_value(obj, rel, foreign_oid) if 
options[:preprocess]
121: end
122: obj.send("__force_#{rel.foreign_key}", foreign_oid)
123: elsif rel.kind_of?(Og::JoinsMany) || rel.kind_of?(Og::HasMany)
124: collection = obj.send(rel_name)
125: collection.remove_all
126: if values.has_key?(rel_name)
127: primary_keys = values[rel_name]
128:
129: # if custom preprocessing is active then try and preprocess
130: primary_keys = preprocess_value(obj, rel, primary_keys) if 
options[:preprocess]
c:/ruby/lib/ruby/gems/1.8/gems/glue-0.30.0.1/lib/glue/property.rb:105:in 
`each'
100: obj.send("__force_#{prop_name}", 0)
101: end
102: end
103:
104: if options[:assign_relations]
105: for rel in obj.class.relations
106:
107: unless options[:all]
108: next if rel.options[:control] == :none or rel.options[:disable_control]
109: end
110:
c:/ruby/lib/ruby/gems/1.8/gems/glue-0.30.0.1/lib/glue/property.rb:105:in 
`populate_object'
100: obj.send("__force_#{prop_name}", 0)
101: end
102: end
103:
104: if options[:assign_relations]
105: for rel in obj.class.relations
106:
107: unless options[:all]
108: next if rel.options[:control] == :none or rel.options[:disable_control]
109: end
110:
c:/ruby/lib/ruby/gems/1.8/gems/nitro-0.30.0.1/lib/nitro/context.rb:156:in 
`fill'
151: # Prefer to use the following form:
152: #
153: # User.new.assign_with(request)
154:
155: def fill(obj, options = {})
156: Property.populate_object(obj, @params, options)
157: end
158: alias_method :populate, :fill
159: alias_method :assign, :fill
160:
161: # Is the current action the top level action? The level
(eval):9:in `ts__save'
(eval):6:in `ts__save_action'
c:/ruby/lib/ruby/gems/1.8/gems/nitro-0.30.0.1/lib/nitro/controller.rb:109:in 
`send'
104: # for this controller.
105:
106: base.module_eval do
107: def method_missing(action, *args)
108: if Compiler.new(self.class).compile(action)
109: send(action, *args)
110: else
111: super
112: end
113: end
114: end
c:/ruby/lib/ruby/gems/1.8/gems/nitro-0.30.0.1/lib/nitro/controller.rb:109:in 
`method_missing'
104: # for this controller.
105:
106: base.module_eval do
107: def method_missing(action, *args)
108: if Compiler.new(self.class).compile(action)
109: send(action, *args)
110: else
111: super
112: end
113: end
114: end
c:/ruby/lib/ruby/gems/1.8/gems/nitro-0.30.0.1/lib/nitro/render.rb:133:in 
`send'
128: old_controller = Controller.replace_current(@controller)
129:
130: if self.class == @controller
131: self.send(action)
132: else
133: @controller.new(@context, base).send(action)
134: end
135:
136: Controller.replace_current(old_controller)
137: @context.level -= 1
138:
c:/ruby/lib/ruby/gems/1.8/gems/nitro-0.30.0.1/lib/nitro/render.rb:133:in 
`render'
128: old_controller = Controller.replace_current(@controller)
129:
130: if self.class == @controller
131: self.send(action)
132: else
133: @controller.new(@context, base).send(action)
134: end
135:
136: Controller.replace_current(old_controller)
137: @context.level -= 1
138:
c:/ruby/lib/ruby/gems/1.8/gems/nitro-0.30.0.1/lib/nitro/adapter/webrick.rb:221:in 
`do_POST'
216: context.headers['REQUEST_URI'] = '/' + context.headers['REQUEST_URI']
217:
218: Cgi.parse_params(context)
219: Cgi.parse_cookies(context)
220:
221: context.render(path)
222:
223: res.status = context.status
224: res.instance_variable_set(:@header, context.response_headers || {})
225: res.instance_variable_set(:@cookies, context.response_cookies || {})
226: res.body = context.out
c:/ruby/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in `__send__'
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
c:/ruby/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in `service'
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
c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
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
c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
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)
c:/ruby/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'
150: rescue SocketError
151: @logger.debug "accept: <address unknown>"
152: raise
153: end
154: call_callback(:AcceptCallback, sock)
155: block ? block.call(sock) : run(sock)
156: rescue Errno::ENOTCONN
157: @logger.debug "Errno::ENOTCONN raised"
158: rescue ServerError => ex
159: msg = "#{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}"
160: @logger.error msg
c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start'
139: end
140:
141: private
142:
143: def start_thread(sock, &block)
144: Thread.start{
145: begin
146: Thread.current[:WEBrickSocket] = sock
147: begin
148: addr = sock.peeraddr
149: @logger.debug "accept: #{addr[3]}:#{addr[1]}"
c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'
139: end
140:
141: private
142:
143: def start_thread(sock, &block)
144: Thread.start{
145: begin
146: Thread.current[:WEBrickSocket] = sock
147: begin
148: addr = sock.peeraddr
149: @logger.debug "accept: #{addr[3]}:#{addr[1]}"
c:/ruby/lib/ruby/1.8/webrick/server.rb:94:in `start'
89: svrs[0].each{|svr|
90: @tokens.pop # blocks while no token is there.
91: sock = svr.accept
92: sock.sync = true
93: Utils::set_close_on_exec(sock)
94: th = start_thread(sock, &block)
95: th[:WEBrickThread] = true
96: thgroup.add(th)
97: }
98: end
99: rescue Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPROTO => ex
c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `each'
84: thgroup = ThreadGroup.new
85: @status = :Running
86: while @status == :Running
87: begin
88: if svrs = IO.select(@listeners, nil, nil, 2.0)
89: svrs[0].each{|svr|
90: @tokens.pop # blocks while no token is there.
91: sock = svr.accept
92: sock.sync = true
93: Utils::set_close_on_exec(sock)
94: th = start_thread(sock, &block)
c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `start'
84: thgroup = ThreadGroup.new
85: @status = :Running
86: while @status == :Running
87: begin
88: if svrs = IO.select(@listeners, nil, nil, 2.0)
89: svrs[0].each{|svr|
90: @tokens.pop # blocks while no token is there.
91: sock = svr.accept
92: sock.sync = true
93: Utils::set_close_on_exec(sock)
94: th = start_thread(sock, &block)
c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'
74:
75: def start(&block)
76: raise ServerError, "already started." if @status != :Stop
77: server_type = @config[:ServerType] || SimpleServer
78:
79: server_type.start{
80: @logger.info \
81: "#{self.class}#start: pid=#{$$} port=#{@config[:Port]}"
82: call_callback(:StartCallback)
83:
84: thgroup = ThreadGroup.new
c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'
74:
75: def start(&block)
76: raise ServerError, "already started." if @status != :Stop
77: server_type = @config[:ServerType] || SimpleServer
78:
79: server_type.start{
80: @logger.info \
81: "#{self.class}#start: pid=#{$$} port=#{@config[:Port]}"
82: call_callback(:StartCallback)
83:
84: thgroup = ThreadGroup.new
c:/ruby/lib/ruby/gems/1.8/gems/nitro-0.30.0.1/lib/nitro/adapter/webrick.rb:59:in 
`start'
54:
55: @webrick.mount('/', WebrickAdapter, server)
56:
57: initialize_webrick(server)
58:
59: @webrick.start
60: end
61:
62: # Stop the Webrick adapter.
63:
64: def stop
c:/ruby/lib/ruby/gems/1.8/gems/nitro-0.30.0.1/lib/nitro/server/runner.rb:341:in 
`invoke_server'
336: case @server
337: when :webrick
338: require 'nitro/adapter/webrick'
339: puts "==> Listening at #{server.address}:#{server.port}. [WEBRICK]"
340: puts "==> Press Ctrl-C to shutdown; Run with --help for options.\n\n"
341: Webrick.start(server)
342:
343: when :mongrel
344: require 'nitro/adapter/mongrel'
345: puts "==> Listening at #{server.address}:#{server.port}. [MONGREL]"
346: puts "==> Press Ctrl-C to shutdown; Run with --help for options.\n\n"
c:/ruby/lib/ruby/gems/1.8/gems/nitro-0.30.0.1/lib/nitro/server/runner.rb:303:in 
`invoke'
298: require 'nitro/adapter/console'
299: $server = server
300: $app = ConsoleAdapter.new(server)
301:
302: else
303: invoke_server(server)
304: end
305: end
306:
307: # ...
308:
c:/ruby/lib/ruby/gems/1.8/gems/nitro-0.30.0.1/lib/nitro/server.rb:128:in 
`run'
123: end
124:
125: server = Server.new
126: server.start(options)
127:
128: runner.invoke(server) unless $NITRO_NO_INVOKE
129:
130: return server
131: end
132:
133: # A Helper class used for CherryPy-style publishing.
c:/ruby/lib/ruby/gems/1.8/gems/nitro-0.30.0.1/lib/nitro.rb:78:in `run'
73: class << self
74:
75: # A helper method to start a Nitro application.
76:
77: def run(controller = nil)
78: Server.run(controller)
79: end
80: alias_method :start, :run
81:
82: # A helper to get the current execution mode.
83:
run.rb:17 





More information about the Nitro-general mailing list