[SCM] ci-tooling packaging branch, master, updated. b83c1b652a97060bd6b3ed170a8d8360b563bfed
Harald Sitter
apachelogger-guest at moszumanska.debian.org
Sun Jan 4 22:48:03 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=8bb1bad
The following commit has been merged in the master branch:
commit 8bb1bad721fdbb2438c4f7398c5b5c3315fcc908
Author: Harald Sitter <sitter at kde.org>
Date: Sun Jan 4 23:46:29 2015 +0100
lp: implement self_link auto-use when a param has it
---
lib/lp.rb | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/lib/lp.rb b/lib/lp.rb
index 0f5d22b..84f8a4c 100644
--- a/lib/lp.rb
+++ b/lib/lp.rb
@@ -90,8 +90,6 @@ module Launchpad
return JSON::parse(data, :object_class => Rubber)
end
- # TODO: params hash should get values checked if they respond to self_link and if so use that instead
-
# Pointer to a different URL reflecting a collection of things.
if self["#{name}_collection_link"]
ret = []
@@ -104,24 +102,25 @@ module Launchpad
end
end
+ # Build parameters.
+ # For convenience reasons passing a parameter object that itself
+ # responds to self_link will result in its self_link being passed.
+ params = args[0]
+ params ||= {}
+ params['ws.op']= name.to_s.chomp('!')
+ params.each do | key, value |
+ next unless value["self_link"] rescue next
+ params[key] = value["self_link"]
+ end
+
+ uri = URI(self['self_link'])
+ uri.query = URI.encode_www_form(params)
+
# Try to call as a 'function' on the API
if name.to_s.end_with?('!') # foo! causes a post
- uri = URI(self['self_link'])
- params = args[0]
- params ||= {}
- params['ws.op']= name.to_s.chomp('!')
- uri.query = URI.encode_www_form(params)
- loop do
- Launchpad::post(uri.path, uri.query)
- return nil
- end
+ return Launchpad::post(uri)
else # foo causes a get
ret = []
- uri = URI(self['self_link'])
- params = args[0]
- params ||= {}
- params['ws.op'] = name.to_s
- uri.query = URI.encode_www_form(params)
loop do
obj = Rubber::from_json(Launchpad::get(uri))
if obj['entries']
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list