Mailinglist Archive: yast-commit (2114 mails)

< Previous Next >
[yast-commit] <rest-service> patch_refactor : Fix resource name (bnc#542169)
  • From: Klaus Kämpf <kkaempf@xxxxxxx>
  • Date: Sat, 26 Sep 2009 19:53:56 +0200
  • Message-id: <E1MrZay-0005WA-92@xxxxxxxxxxxxxxxx>
ref: refs/heads/patch_refactor
commit e2708af5e2358e90facd64771a71ead0e2db9324
Author: Klaus Kämpf <kkaempf@xxxxxxx>
Date: Sat Sep 26 19:53:56 2009 +0200

Fix resource name (bnc#542169)
---
webservice/lib/resource_registration.rb | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/webservice/lib/resource_registration.rb
b/webservice/lib/resource_registration.rb
index a2fb733..4330ee8 100644
--- a/webservice/lib/resource_registration.rb
+++ b/webservice/lib/resource_registration.rb
@@ -123,9 +123,6 @@ public
map.root :controller => "resources", :action => "index"
resources.each do |interface,implementations|

- qualifiers = interface.split "."
- name = qualifiers.pop
-
implementations.each do |implementation|

# url and controller are closely coupled
@@ -134,6 +131,7 @@ public
# the last one specifies the resource name and thus the controller
name
#
namespaces = implementation[:controller].split "/"
+ name = namespaces[-1]

# the .namespace call affects the URI _and_ the controller path (!)

@@ -143,11 +141,11 @@ public
toplevel = ns
end
end
-
+ params = [ name, { :controller => namespaces.join("/"), :except => [
:new, :edit ] } ]
if implementation[:singular]
- toplevel.resource name, :controller => namespaces.join("/"),
:except => [ :new, :edit ]
+ toplevel.resource *params
else
- toplevel.resources name, :except => [ :new, :edit ] do |mapping|
+ toplevel.resources *params do |mapping|
nested = implementation[:nested] and mapping.resources(nested)
end
end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages