[Nitro] request params -> action params

Jonathan Buch john at oxyliquit.de
Fri Sep 1 08:11:35 EDT 2006


> I made some changes to the way the request uri parameters are
> converted to action parameters. I am wondering if these changes fix an
> older reported bug. It does work more reliabbly for me (and the
> implementation is a lot cleaner).

this patch doesn't fix the previous bug, in fact it makes it worse.

def update(oid = nil)


If you try that, you'll see that it never works, that it gets filled
with nil in any case.  Like your comment above the code says, there are
negative numbers in case there are parameters which are optional.

* positive numbers are normal, non optional parameters
* zero is for no parameters
* -1 always specifies 0 or more parameters
   def a(b = nil); end
   def a(*args); end
   def a(b=nil, c=nil); end
* below -1, (arity.abs - 1) non optional parameters, at least one
   optional parameter.
* Other wierd stuff I found:
   def a(c, b=nil, &d); end # => arity 2

Since that param bug was introduced, I have as a workaround *args at
the end of the problematic actions (insert/update).

Well, what I'm saying is:  One has to be very careful with that param
stuff, as it's quite non-trivial and can kill any webapp.

If you want me to, I can throw tests at you while you are searching
for a correct implementation.  Information I would need is how to send
POST requests as well as GET requests (as that isn't shown in the test
suite of compiler.rb).

I'm not sure what the ideal implementation would be... maybe to disable
parameter injection when it got already (partly) filled by a nice-url?
I'm not sure what to do with half-filled actions, as they 'should'
raise errors, but the error handling should be application specific..

Sorry for the rant.


Feel the love

More information about the Nitro-general mailing list