[Nitro] request parameters
Chris Farmiloe
chris at motionpath.com
Tue Nov 22 11:53:04 EST 2005
> ...this suggestion is not viable when the reason for the periods
> is to map to nested data, and underscores '_' are already in use
> in simple multi-word names.
Good point.
> The point is that we should be able to use any normally legal
> (for CGI programming) request parameter names and be able to
> retrieve their values without data-structure-walking gymnastics.
>
> If the framework *also* wants to categorize the request parameters
> (making a tree-shaped data structure like it does now) it should
> be free to do so...but should not break the traditional CGI-style
> programs in the process.
Yeah I guess it doesn't really fit with Nitro's "Choice" ethos
well ... until someone want to trek through cgi.rb, *hides*
you could override the request getter methods by requiring something
like this in your run.rb to give you the kinda functionality your
after temporarily?
module Nitro
# Overides fetch and it's shortcut [] to allow access to 'this.that'
params
module Request
def [](param)
fetch(param)
end
def fetch(param, default = nil)
if param =~ /\./
keys = param.split('.')
param = @params
keys.each do |k|
param = param.fetch(k, default)
end
param
else
param = @params.fetch(param, default)
end
end
end
end
Chris Farmiloe
Design & Development.
Motionpath Digital Media Ltd.
St Georges road, Brighton, BN2 1ED.
Office: 01273 608708 | Mobile: 07791 179481
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20051122/14d137bb/attachment.html
More information about the Nitro-general
mailing list