[Nitro] PATCH: Multipart forms and @params, Some Controls code updates.

Bryan Soto bryan.a.soto at gmail.com
Thu Jan 5 20:27:21 EST 2006


Hi,

On a personal note, I find I'm understanding a bit more how Nitro works with
your and Peter's submissions (I haven't gotten to Kashia's yet :)

That said, I ran into a problem with it I can't quite figure out.

The attached run.rb (set to sqlite, but mysql or postgres should work. Not
kirby since it uses many_to_many) causes this error when:

1) Run against glycerin:

RUBYOPT=-rubygems ruby -I#{glycerin}/glue/lib -I#{glycerin}/nitro/lib
-I#{glycerin}/nitro/src -I#{glycerin}/og/lib run.rb

2) From /admin create a user.

3) Leave permissions set to None

4) Save.

It's something in the patch as it doesn't happen against unpatched glycerin,
but I can't quite figure out where. Adding a breakpoint to
glue/property.rb:123 shows v is an empty StringIO.

  primary_keys.each do |v|
    # require 'dev-utils/debug'; breakpoint
    next if v == 'nil' or v == 'none'
    collection << rel.target_class[v.to_s.to_i]
  end

I hope this helps someone figure out what exactly is happening.

E, [2006-01-05T16:21:25.985566 #4529] ERROR -- : Error while handling
'/admin/users/save'.
E, [2006-01-05T16:21:26.002286 #4529] ERROR -- : undefined method `unsaved?'
for nil:NilClass
  (eval):25:in `add_permission'
  /home/bryan/checkout/darcs/dev-nitro/og/lib/og/collection.rb:123:in `<<'
  /home/bryan/checkout/darcs/dev-nitro/glue/lib/glue/property.rb:124:in
`populate_object'
  /home/bryan/checkout/darcs/dev-nitro/glue/lib/glue/property.rb:122:in
`populate_object'
  /home/bryan/checkout/darcs/dev-nitro/glue/lib/glue/property.rb:95:in
`populate_object'
  /home/bryan/checkout/darcs/dev-nitro/nitro/lib/nitro/context.rb:100:in
`fill'
  (eval):9:in `users__save'
  (eval):6:in `users__save_action'
  /home/bryan/checkout/darcs/dev-nitro/nitro/lib/nitro/render.rb:127:in
`render'

/home/bryan/checkout/darcs/dev-nitro/nitro/lib/nitro/adapter/webrick.rb:151:in
`do_POST'
  /usr/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in `service'
  /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'

/home/bryan/checkout/darcs/dev-nitro/nitro/lib/nitro/adapter/webrick.rb:55:in
`start'

/home/bryan/checkout/darcs/dev-nitro/nitro/lib/nitro/server/runner.rb:307:in
`invoke_server'

/home/bryan/checkout/darcs/dev-nitro/nitro/lib/nitro/server/runner.rb:273:in
`invoke'
  /home/bryan/checkout/darcs/dev-nitro/nitro/lib/nitro/server.rb:123:in
`run'
  /home/bryan/checkout/darcs/dev-nitro/nitro/lib/nitro.rb:73:in `start'
  run.rb:22


On 1/5/06, Bryan Soto <bryan.a.soto at gmail.com> wrote:
>
> Just a quick note, after applying this patch there was an additional
> failure in the nitro unit tests:
>
>   3) Failure:
> test_parse_query_parameters(TestAdapterCgi) [./test/nitro/tc_cgi.rb:36]:
> <2> expected but was
> <3>.
>
> On 1/5/06, Chris Farmiloe <chris at motionpath.com> wrote:
>
> >
> >
> > Happy 2006 list!...
> >
> > Haven't quiet got round to getting up to speed with the list
> > -99 nitro emails was my christmas present from the list ;-)
> > sure it's all great!
> >
> > anyway. here's some patches:
> >
> > Mostly control code related, (and there'll be more to follow including
> > a blob upload control), started an array control.
> >
> >
> > Fixed the multipart form data issues not being compatible with
> > the @params hash, I think I also made the params array operate like
> > someone on the list wanted (request[' this.that'] and
> > request['this']['that']
> > should both work - will maybe move this functionality to the request []
> > method
> > if everyone things that the @params hash looks a mess.
> >
> > --next step is to make the structure_params function recursive so that
> > more complicated depth can be achieved with the POST data ie. INPUTS
> > with names:
> >
> > name=" person.name"
> > name="person.address.name"
> > name="person.address.line1 "
> > name="person.address.line2"
> > name="person.address.phone[]"
> > name="person.address.phone[]"
> >
> > creating the @params (request) hash as
> >
> > {
> > 'person' => {
> > 'address' => {
> > 'name' => 'string',
> > 'line1' => 'string',
> > 'line2' => 'string',
> > 'phone' => ['string','string']
> > }
> > }
> > }
> >
> >
> >
> > right. home time.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > chrisfarms
> > Design & Development.
> >
> >
> >
> >
> > _______________________________________________
> > Nitro-general mailing list
> > Nitro-general at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/nitro-general
> >
> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20060105/680d1f11/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: run.rb
Type: application/octet-stream
Size: 296 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20060105/680d1f11/attachment.obj 


More information about the Nitro-general mailing list