comparison rhodecode/bin/rhodecode_api.py @ 2505:02fc6ce0cd44 beta

don't make a api call after doing create_config
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 25 Jun 2012 23:08:06 +0200
parents e487d2a6aa38
children 955956f4bdda
comparison
equal deleted inserted replaced
2504:4cf9af8ee623 2505:02fc6ce0cd44
140 "args": kw 140 "args": kw
141 } 141 }
142 142
143 if not method: 143 if not method:
144 raise Exception('please specify method name !') 144 raise Exception('please specify method name !')
145 id_ = random.randrange(1, 200) 145 id_ = random.randrange(1, 9999)
146 req = urllib2.Request('%s/_admin/api' % apihost, 146 req = urllib2.Request('%s/_admin/api' % apihost,
147 data=json.dumps(_build_data(id_)), 147 data=json.dumps(_build_data(id_)),
148 headers={'content-type': 'text/plain'}) 148 headers={'content-type': 'text/plain'})
149 if format == FORMAT_PRETTY: 149 if format == FORMAT_PRETTY:
150 sys.stdout.write('calling %s to %s \n' % (req.get_data(), apihost)) 150 sys.stdout.write('calling %s to %s \n' % (req.get_data(), apihost))
219 '--apikey or --apihost in params') 219 '--apikey or --apihost in params')
220 220
221 apikey = args.apikey or conf['apikey'] 221 apikey = args.apikey or conf['apikey']
222 host = args.apihost or conf['apihost'] 222 host = args.apihost or conf['apihost']
223 method = args.method 223 method = args.method
224 if method == '_create_config':
225 sys.exit()
224 margs = dict(map(lambda s: s.split(':', 1), other)) 226 margs = dict(map(lambda s: s.split(':', 1), other))
225 227
226 api_call(apikey, host, args.format, method, **margs) 228 api_call(apikey, host, args.format, method, **margs)
227 return 0 229 return 0
228 230