Forum: Nitro OgAdminController#save still broken

Posted by Robert Mela (Guest)
on 2007-10-23 23:15
Attachment: rob.vcf (117 Bytes)
(Received via mailing list)
request['foovar'] works fine normally ( see illustration code ) but
blows up inside OgAdminController#save (again, just run the attached
sample code )

Run using a fresh darcs get.  Am I the only one seeing these problems
with OgAdminController#save?   Is nobody using the admin part?  Is it
somehow related to using WEBrick or SQLite?

With each new darcs get I put my own workaround into OgAdminController
-- replacing request[] with post_params[], after which everything works
fine.



ERROR: Error while handling OgAdminController#save()
ERROR: undefined method `[]' for nil:NilClass

/Users/rmela/nitro/repo.nitroproject.org/script/lib/../../raw/lib/raw/context/request.rb:304:in
`[]'

/Users/rmela/nitro/repo.nitroproject.org/script/lib/../../nitro/lib/nitro/part/admin/og/controller.rb:93:in
`save'
  (eval):4:in `call'
  (eval):4:in `save'

/Users/rmela/nitro/repo.nitroproject.org/script/lib/../../raw/lib/raw/compiler.rb:65:in
`send'

/Users/rmela/nitro/repo.nitroproject.org/script/lib/../../raw/lib/raw/compiler.rb:65:in
`save___super'

/Users/rmela/nitro/repo.nitroproject.org/script/lib/../../raw/lib/raw/controller/publishable.rb:36:in
`send'

/Users/rmela/nitro/repo.nitroproject.org/script/lib/../../raw/lib/raw/controller/publishable.rb:36:in
`method_missing'

/Users/rmela/nitro/repo.nitroproject.org/script/lib/../../raw/lib/raw/controller/render.rb:92:in
`send'

/Users/rmela/nitro/repo.nitroproject.org/script/lib/../../raw/lib/raw/controller/render.rb:92:in
`render_action'

/Users/rmela/nitro/repo.nitroproject.org/script/lib/../../raw/lib/raw/adapter.rb:68:in
`send'

/Users/rmela/nitro/repo.nitroproject.org/script/lib/../../raw/lib/raw/adapter.rb:68:in
`handle_context'

/Users/rmela/nitro/repo.nitroproject.org/script/lib/../../raw/lib/raw/adapter/webrick.rb:134:in
`do_POST'
  /opt/local/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in 
`__send__'
  /opt/local/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in 
`service'
  /opt/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  /opt/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  /opt/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  /opt/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
  /opt/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  /opt/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
  /opt/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
  /opt/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
  /opt/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
  /opt/local/lib/ruby/1.8/webrick/server.rb:82:in `start'

/Users/rmela/nitro/repo.nitroproject.org/script/lib/../../raw/lib/raw/adapter/webrick.rb:57:in
`start'

/Users/rmela/nitro/repo.nitroproject.org/script/lib/../../nitro/lib/nitro/application.rb:135:in
`start'
  ./app.rb:34
  LOGGED FROM:
/Users/rmela/nitro/repo.nitroproject.org/script/lib/../../raw/lib/raw/controller/render.rb:108:in
`render_action'


#!/usr/bin/env ruby

require 'nitro_and_og'
include Nitro

require 'nitro/part/admin'

class Book
   attr_accessor :title, String
   many_to_many Author
end

class Author
   attr_accessor :name, String
   has_many Book
end

Og.start( :adapter => :sqlite, :database => 'library',
          :create_schema => true, :destroy_schema => true )

class MyController
  def index
    render_text "<a href='admin'>admin</a><br/><a
href='sampleform'>Sample Form</a>"
  end

  def sampleform
    render_text "<form action='samplepost' method='POST'>
                 <input type='text' name='foo' value='bar'/><input
type='submit' name='ClickMe'/>"
  end

  def samplepost
    render_text "You entered '#{request['foo']}' in the text field"
  end

end

app = Application.new
disp=app.dispatcher
disp.root = MyController
app.start
Posted by chris (Guest)
on 2007-10-24 05:52
(Received via mailing list)
I have this same issue in 0.50.0
Posted by George Moschovitis (Guest)
on 2007-10-24 09:34
(Received via mailing list)
I am using a custom Admin like part, so I have not seen it.
Rob, can you send me a patch for this?

-g.
Posted by Robert Mela (Guest)
on 2007-10-25 04:56
Attachment: og_admin_controller_fix.tar.gz (19 KB)
Attachment: og_admin_controller_fix.gz (18,9 KB)
Attachment: rob.vcf (117 Bytes)
(Received via mailing list)
Could I try the custom admin part?  I'm wondering why that would behave
differently.

What's attached is a workaround -- calling request.post_params['oid']
instead of request['oid'].  What should really be fixed -- which will
take a while to get to -- is whatever's causing the request['oid'] to
fail in OgAdminController despite working elsewhere.   Looks a bit like
an order of initialization thing, or a clash between two definitions.

I forget whether you need tar.gz or gz so here's both.
Posted by George Moschovitis (Guest)
on 2007-10-25 09:37
(Received via mailing list)
>
> Could I try the custom admin part?  I'm wondering why that would behave
> differently.


by custom I mean totally recoded ;-) When it is ready for public 
consumption
I will release it
as an alternative to the AdminPart.

-g.

PS: thanks for the patch.
This topic is locked and can not be replied to.