Skip to content

Commit

Permalink
Merge pull request #12 from gnuman/code-refactor-pull-request
Browse files Browse the repository at this point in the history
Issue:- create version don't work
  • Loading branch information
gnuman committed Nov 28, 2014
2 parents c22d14b + 5713bdd commit d2ab1de
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
2 changes: 0 additions & 2 deletions zanata.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
local.url = http://localhost:8080/flies
local.username = username
local.key = key


4 changes: 1 addition & 3 deletions zanataclient/zanata.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,8 @@ def read_user_config(url, command_options):
for path in user_config:
if os.path.exists(path):
log.info("Loading zanata user config from: %s" % path)

#Read the user-config file
config.set_userconfig(path)

try:
server = config.get_server(url)
if server:
Expand Down Expand Up @@ -693,7 +691,7 @@ def create_version(command_options, args):
version_desc = command_options['version_desc'][0]['value']
log.warn("This option is deprecated, it should not be used on new zanata server")

zanatacmd = generate_zanatacmd(url, username, apikey)
zanatacmd = generate_zanatacmd(url, username, apikey,headers)

if command_options.has_key('disablesslcert'):
zanatacmd.disable_ssl_cert_validation()
Expand Down
1 change: 1 addition & 0 deletions zanataclient/zanatacmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def verify_project(self, project_id, version_id):
except ZanataException, e:
self.log.error(str(e))


def update_template(self, project_id, iteration_id, filename, body, copytrans):
if '/' in filename:
request_name = filename.replace('/', ',')
Expand Down
4 changes: 2 additions & 2 deletions zanataclient/zanatalib/projectservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ def get(self, projectid):
"""
if self.http_headers:
self.http_headers['Accept'] = 'application/json'


res, content = self.restclient.request(self.base_url+'/seam/resource/restv1/projects/p/%s'%projectid,"get",None,self.http_headers)

server_return = self.messages(res,content)
if server_return.has_key('status'):
if server_return['status'] == "Retired":
print "Warning: The project %s is retired!" % projectid

project = Project(server_return)
project.set_iteration(self.iterations)
return project
Expand Down Expand Up @@ -143,7 +143,7 @@ def create(self, projectid, iteration):
"""

body = '''{"name":"%s","id":"%s","description":"%s"}'''%(iteration.name, iteration.id, iteration.desc)
res, content = self.restclient.request_put('/seam/resource/restv1/projects/p/%s/iterations/i/%s'%(projectid,iteration.id), args=body, headers=http_headers)
res, content = self.restclient.request_put('/seam/resource/restv1/projects/p/%s/iterations/i/%s'%(projectid,iteration.id), args=body, headers=self.http_headers)
self.messages(res,content,"The Version is already exist on server")

def delete(self):
Expand Down
1 change: 1 addition & 0 deletions zanataclient/zanatalib/versionservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def get_server_version(self):
self.http_headers.update(
{'Accept':'application/vnd.zanata.Version+json'}
)

res, content = self.restclient.request_version(
'/seam/resource/restv1/version',
self.http_headers
Expand Down

0 comments on commit d2ab1de

Please sign in to comment.