public
Fork of rails/rails
Description: Ruby on Rails - forked for implementing I18n patch
Homepage: http://rubyonrails.org
Clone URL: git://github.com/svenfuchs/rails.git
allow direct dispatching methods to declare their parameters as well, for 
brevity's sake, it seems
to be counter-intuitive not to do so (closes #939). update gem require 
versions.
fix unit tests for exception de-shallowing changes.


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@992 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Leon Breedt (author)
Fri Mar 25 16:20:19 -0800 2005
commit  8032c4ffd47ba4deb5cbd88a462b837240eb593c
tree    644884307c403b47c883a4c699ea0c8472fd75ac
parent  771244a58ce812198e7171e4ee0ae5b27032ead0
...
 
 
 
 
1
2
3
...
1
2
3
4
5
6
7
0
@@ -1,3 +1,7 @@
0
+*0.7.0* (Unreleased)
0
+
0
+* Allow method declarations for direct dispatching to declare parameters as well. We treat an arity of < 0 or > 0 as an indication that we should send through parameters. Closes #939.
0
+
0
 *0.6.1* (22th March, 2005)
0
 
0
 * Fix that method response QNames mismatched with that declared in the WSDL, makes SOAP::WSDLDriverFactory work against AWS again
...
27
28
29
30
31
32
 
 
 
33
34
35
...
27
28
29
 
 
 
30
31
32
33
34
35
0
@@ -27,9 +27,9 @@ begin
0
   require 'active_record'
0
 rescue LoadError
0
   require 'rubygems'
0
- require_gem 'activesupport', '>= 0.9.0'
0
- require_gem 'actionpack', '>= 1.4.0'
0
- require_gem 'activerecord', '>= 1.6.0'
0
+ require_gem 'activesupport', '>= 1.0.2'
0
+ require_gem 'actionpack', '>= 1.6.0'
0
+ require_gem 'activerecord', '>= 1.9.0'
0
 end
0
 
0
 $:.unshift(File.dirname(__FILE__) + "/action_web_service/vendor/")
...
34
35
36
37
 
 
 
 
 
 
38
39
40
...
34
35
36
 
37
38
39
40
41
42
43
44
45
0
@@ -34,7 +34,12 @@ module ActionWebService # :nodoc:
0
       
0
         def web_service_direct_invoke(invocation)
0
           @method_params = invocation.method_ordered_params
0
- return_value = self.__send__(invocation.api_method_name)
0
+ arity = method(invocation.api_method_name).arity rescue 0
0
+ if arity < 0 || arity > 0
0
+ return_value = self.__send__(invocation.api_method_name, *@method_params)
0
+ else
0
+ return_value = self.__send__(invocation.api_method_name)
0
+ end
0
           if invocation.api.has_api_method?(invocation.api_method_name)
0
             returns = invocation.returns ? invocation.returns[0] : nil
0
           else
...
40
41
42
 
43
44
45
...
141
142
143
 
144
145
146
...
159
160
161
 
 
 
 
162
163
164
...
212
213
214
 
 
215
216
217
...
40
41
42
43
44
45
46
...
142
143
144
145
146
147
148
...
161
162
163
164
165
166
167
168
169
170
...
218
219
220
221
222
223
224
225
0
@@ -40,6 +40,7 @@ module DispatcherTest
0
 
0
   class DirectAPI < ActionWebService::API::Base
0
     api_method :add, :expects => [{:a=>:int}, {:b=>:int}], :returns => [:int]
0
+ api_method :add2, :expects => [{:a=>:int}, {:b=>:int}], :returns => [:int]
0
     api_method :before_filtered
0
     api_method :after_filtered, :returns => [[:int]]
0
     api_method :struct_return, :returns => [[Node]]
0
@@ -141,6 +142,7 @@ module DispatcherTest
0
     after_filter :alwaysok, :only => [:after_filtered]
0
 
0
     attr :added
0
+ attr :added2
0
     attr :before_filter_called
0
     attr :before_filter_target_called
0
     attr :after_filter_called
0
@@ -159,6 +161,10 @@ module DispatcherTest
0
       @added = @params['a'] + @params['b']
0
     end
0
 
0
+ def add2(a, b)
0
+ @added2 = a + b
0
+ end
0
+
0
     def before_filtered
0
       @before_filter_target_called = true
0
     end
0
@@ -212,6 +218,8 @@ module DispatcherCommonTests
0
   def test_direct_dispatching
0
     assert_equal(70, do_method_call(@direct_controller, 'Add', 20, 50))
0
     assert_equal(70, @direct_controller.added)
0
+ assert_equal(50, do_method_call(@direct_controller, 'Add2', 25, 25))
0
+ assert_equal(50, @direct_controller.added2)
0
     assert(@direct_controller.void_called == false)
0
     case @encoder
0
     when WS::Encoding::SoapRpcEncoding
...
2
3
4
 
 
 
 
 
 
 
 
 
 
 
 
5
6
7
...
39
40
41
42
 
43
44
45
...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
...
51
52
53
 
54
55
56
57
0
@@ -2,6 +2,18 @@ $:.unshift(File.dirname(__FILE__) + '/apis')
0
 require File.dirname(__FILE__) + '/abstract_dispatcher'
0
 require 'wsdl/parser'
0
 
0
+class ActionController::Base
0
+ class << self
0
+ alias :inherited_without_name_error :inherited
0
+ def inherited(child)
0
+ begin
0
+ inherited_without_name_error(child)
0
+ rescue NameError => e
0
+ end
0
+ end
0
+ end
0
+end
0
+
0
 class AutoLoadController < ActionController::Base; end
0
 class FailingAutoLoadController < ActionController::Base; end
0
 class BrokenAutoLoadController < ActionController::Base; end
0
@@ -39,7 +51,7 @@ class TC_DispatcherActionControllerSoap < Test::Unit::TestCase
0
     assert(!AutoLoadController.web_service_api.nil?)
0
     assert(AutoLoadController.web_service_api.has_public_api_method?('Void'))
0
     assert(FailingAutoLoadController.web_service_api.nil?)
0
- assert_raises(LoadError, NameError) do
0
+ assert_raises(MissingSourceFile) do
0
       FailingAutoLoadController.require_web_service_api :blah
0
     end
0
     assert_raises(ArgumentError) do

Comments

    No one has commented yet.