diff --git a/getlocalization/api/client/Query.py b/getlocalization/api/client/Query.py index b263232..fcf4c5d 100644 --- a/getlocalization/api/client/Query.py +++ b/getlocalization/api/client/Query.py @@ -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() diff --git a/getlocalization/cli/commands.py b/getlocalization/cli/commands.py index 6ba1ef5..b225d8b 100644 --- a/getlocalization/cli/commands.py +++ b/getlocalization/cli/commands.py @@ -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') @@ -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)) @@ -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: @@ -320,4 +320,4 @@ def prompt_userpw(): def main(): #print "Get Localization CLI (C) 2010-2013 Synble Ltd. All rights reserved.\n" d.dispatch() - \ No newline at end of file + diff --git a/setup.py b/setup.py index 3947cd4..e829337 100644 --- a/setup.py +++ b/setup.py @@ -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',