Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #9 from henrygl/master
Fix push-tr
  • Loading branch information
pmuilu committed Oct 13, 2016
2 parents 5e904bc + 204f7d4 commit 0bed3ee
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion getlocalization/api/client/Query.py
Expand Up @@ -89,7 +89,7 @@ def postFile(self, file_, pathname, url):
handle = urllib2.urlopen(request)
data = handle.read()

if handle.getcode() != 200:
if handle.getcode() not in (200, 201):
raise QueryException(data, handle.getcode())

return handle.getcode()
Expand Down
10 changes: 5 additions & 5 deletions getlocalization/cli/commands.py
Expand Up @@ -223,7 +223,7 @@ def push(**kwargs):
sys.exit(0)

@d.command(shortlist=True)
def push_tr(**kwargs):
def push_tr(force=('f', False, 'also push files existing on server'), **kwargs):
'''Push local mapped translations that don't exist on server'''
repo = Repository();
username = kwargs.get('username')
Expand All @@ -232,9 +232,9 @@ def push_tr(**kwargs):
if username == '' or password == '':
username, password = prompt_userpw()

push_translations(repo, username, password)
push_translations(repo, username, password, force)

def push_translations(repo, username, password):
def push_translations(repo, username, password, force):
# Push translations that don't exist
translations = GLTranslations(GLProject(repo.get_project_name(), username, password))

Expand All @@ -253,7 +253,7 @@ def push_translations(repo, username, password):
if tr.get('master_file') == tr_file[0] and tr.get('iana_code') == tr_file[1]:
found = True

if not found:
if force or not found:
try:
translations.update_translation_file(local_file, tr_file[0], tr_file[1])
except:
Expand Down Expand Up @@ -320,4 +320,4 @@ def prompt_userpw():
def main():
#print "Get Localization CLI (C) 2010-2013 Synble Ltd. All rights reserved.\n"
d.dispatch()


2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -7,7 +7,7 @@

setup(name='gl',
#setup_requires=["py2app"],
version='0.2.36',
version='0.2.37',
description='Get Localization Command-Line Interface',
author='Get Localization',
author_email='support@getlocalization.com',
Expand Down

0 comments on commit 0bed3ee

Please sign in to comment.